// The items are encoded in markup to provide a no-JS fallback.
// Although CKEditor 5 is useless without JS it would still be possible
// to see all the available toolbar items provided by plugins in the format
// that needs to be entered in the textarea. The UI app parses this list.
$form['toolbar'
]['available'
] =
[ '#type' => 'container',
'#title' => 'Available items',
'#id' => 'ckeditor5-toolbar-buttons-available',
'available_items' =>
[ '#markup' => Json::
encode($this->ckeditor5PluginManager->
getToolbarItems()),
],
];
$editor_settings =
$editor->
getSettings();
// This form field requires a JSON-style array of valid toolbar items.
// e.g. ["bold","italic","|","drupalInsertImage"].
// CKEditor 5 config for toolbar items takes an array of strings which
// correspond to the keys under toolbar_items in a plugin yml or annotation.
// @see https://ckeditor.com/docs/ckeditor5/latest/features/toolbar/toolbar.html
$form['toolbar'
]['items'
] =
[ '#type' => 'textarea',