function LlamaContextual::isEnabled in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/ckeditor/tests/modules/src/Plugin/CKEditorPlugin/LlamaContextual.php \Drupal\ckeditor_test\Plugin\CKEditorPlugin\LlamaContextual::isEnabled()
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
- core/
modules/ ckeditor/ tests/ modules/ src/ Plugin/ CKEditorPlugin/ LlamaContextual.php, line 26 - Contains \Drupal\ckeditor_test\Plugin\CKEditorPlugin\LlamaContextual.
Class
- LlamaContextual
- Defines a "Llama" plugin, with a contextually enabled "llama" feature.
Namespace
Drupal\ckeditor_test\Plugin\CKEditorPluginCode
function isEnabled(Editor $editor) {
// Automatically enable this plugin if the Underline button is enabled.
$settings = $editor
->getSettings();
foreach ($settings['toolbar']['rows'] as $row) {
foreach ($row as $group) {
if (in_array('Strike', $group['items'])) {
return TRUE;
}
}
}
return FALSE;
}