public function ListStylePlugin::isEnabled in CKEditor List Style 8
Checks if this plugin should be enabled based on the editor configuration.
The editor's settings can be retrieved via $editor->getSettings().
Parameters
\Drupal\editor\Entity\Editor $editor: A configured text editor object.
Return value
bool
Overrides CKEditorPluginContextualInterface::isEnabled
File
- src/
Plugin/ CKEditorPlugin/ ListStylePlugin.php, line 30
Class
- ListStylePlugin
- Defines the "List Style" plugin.
Namespace
Drupal\ckeditor_liststyle\Plugin\CKEditorPluginCode
public function isEnabled(Editor $editor) {
$enabled = FALSE;
$settings = $editor
->getSettings();
foreach ($settings['toolbar']['rows'] as $row) {
foreach ($row as $group) {
foreach ($group['items'] as $button) {
if ($button === 'BulletedList' || $button === 'NumberedList') {
$enabled = TRUE;
}
}
}
}
return $enabled;
}