function CKEditorPluginManager::getEnabledButtons
Same name in other branches
- 8.9.x core/modules/ckeditor/src/CKEditorPluginManager.php \Drupal\ckeditor\CKEditorPluginManager::getEnabledButtons()
Gets the enabled toolbar buttons in the given text editor instance.
Parameters
\Drupal\editor\Entity\Editor $editor: A configured text editor object.
Return value
string[] A list of the toolbar buttons enabled in the given text editor instance.
3 calls to CKEditorPluginManager::getEnabledButtons()
- CKEditorPluginManager::getEnabledPluginFiles in core/
modules/ ckeditor/ src/ CKEditorPluginManager.php - Retrieves enabled plugins' files, keyed by plugin ID.
- CKEditorPluginManagerTest::testGetEnabledButtons in core/
modules/ ckeditor/ tests/ src/ Unit/ CKEditorPluginManagerTest.php - @covers ::getEnabledButtons @dataProvider providerGetEnabledButtons
- Internal::getConfig in core/
modules/ ckeditor/ src/ Plugin/ CKEditorPlugin/ Internal.php - Returns the additions to CKEDITOR.config for a specific CKEditor instance.
File
-
core/
modules/ ckeditor/ src/ CKEditorPluginManager.php, line 121
Class
- CKEditorPluginManager
- Provides a CKEditor Plugin plugin manager.
Namespace
Drupal\ckeditorCode
public static function getEnabledButtons(Editor $editor) {
$toolbar_rows = [];
$settings = $editor->getSettings();
foreach ($settings['toolbar']['rows'] as $row_number => $row) {
$toolbar_rows[] = array_reduce($settings['toolbar']['rows'][$row_number], function ($result, $button_group) {
return array_merge($result, $button_group['items']);
}, []);
}
return array_unique(NestedArray::mergeDeepArray($toolbar_rows));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.