function LlamaContextualAndButton::isEnabled

Implements \Drupal\ckeditor\Plugin\CKEditorPluginContextualInterface::isEnabled().

Overrides CKEditorPluginContextualInterface::isEnabled

File

drupal/core/modules/ckeditor/tests/modules/lib/Drupal/ckeditor_test/Plugin/CKEditorPlugin/LlamaContextualAndButton.php, line 32
Contains \Drupal\ckeditor_test\Plugin\CKEditorPlugin\LlamaContextualAndButton.

Class

LlamaContextualAndButton
Defines a "LlamaContextualAndbutton" plugin, with a contextually OR toolbar builder-enabled "llama" feature.

Namespace

Drupal\ckeditor_test\Plugin\CKEditorPlugin

Code

function isEnabled(Editor $editor) {

  // Automatically enable this plugin if the Strike button is enabled.
  foreach ($editor->settings['toolbar']['buttons'] as $row) {
    if (in_array('Strike', $row)) {
      return TRUE;
    }
  }
  return FALSE;
}