public function CKEditor::buildToolbarJSSetting in Drupal 10
Same name and namespace in other branches
- 8 core/modules/ckeditor/src/Plugin/Editor/CKEditor.php \Drupal\ckeditor\Plugin\Editor\CKEditor::buildToolbarJSSetting()
- 9 core/modules/ckeditor/src/Plugin/Editor/CKEditor.php \Drupal\ckeditor\Plugin\Editor\CKEditor::buildToolbarJSSetting()
Builds the "toolbar" configuration part of the CKEditor JS settings.
Parameters
\Drupal\editor\Entity\Editor $editor: A configured text editor object.
Return value
array An array containing the "toolbar" configuration.
See also
getJSSettings()
File
- core/
modules/ ckeditor/ src/ Plugin/ Editor/ CKEditor.php, line 445
Class
- CKEditor
- Defines a CKEditor-based text editor for Drupal.
Namespace
Drupal\ckeditor\Plugin\EditorCode
public function buildToolbarJSSetting(Editor $editor) {
$toolbar = [];
$settings = $editor
->getSettings();
foreach ($settings['toolbar']['rows'] as $row) {
foreach ($row as $group) {
$toolbar[] = $group;
}
$toolbar[] = '/';
}
return $toolbar;
}