function LlamaContextual::isEnabled

Same name in other branches
  1. 8.9.x core/modules/ckeditor/tests/modules/src/Plugin/CKEditorPlugin/LlamaContextual.php \Drupal\ckeditor_test\Plugin\CKEditorPlugin\LlamaContextual::isEnabled()

Overrides CKEditorPluginContextualInterface::isEnabled

File

core/modules/ckeditor/tests/modules/src/Plugin/CKEditorPlugin/LlamaContextual.php, line 21

Class

LlamaContextual
Defines a "Llama" plugin, with a contextually enabled "llama" feature.

Namespace

Drupal\ckeditor_test\Plugin\CKEditorPlugin

Code

public 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;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.