class LlamaContextual

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

Plugin annotation


@CKEditorPlugin(
  id = "llama_contextual",
  label = @Translation("Contextual Llama")
)

Hierarchy

Expanded class hierarchy of LlamaContextual

File

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

Namespace

Drupal\ckeditor_test\Plugin\CKEditorPlugin
View source
class LlamaContextual extends Llama implements CKEditorPluginContextualInterface {
  
  /**
   * {@inheritdoc}
   */
  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;
  }
  
  /**
   * {@inheritdoc}
   */
  public function getFile() {
    return $this->moduleList
      ->getPath('ckeditor_test') . '/js/llama_contextual.js';
  }

}

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