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

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

Namespace

Drupal\ckeditor_test\Plugin\CKEditorPlugin
View source
class LlamaContextual extends Llama implements CKEditorPluginContextualInterface {

  /**
   * Implements \Drupal\ckeditor\Plugin\CKEditorPluginContextualInterface::isEnabled().
   */
  function isEnabled(Editor $editor) {

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

  /**
   * Implements \Drupal\ckeditor\Plugin\CKEditorPluginInterface::getFile().
   */
  function getFile() {
    return drupal_get_path('module', 'ckeditor_test') . '/js/llama_contextual.js';
  }

}

Members

Namesort descending Modifiers Type Description Overrides
Llama::getConfig public function Implements \Drupal\ckeditor\Plugin\CKEditorPluginInterface::getButtons(). Overrides CKEditorPluginInterface::getConfig
Llama::isInternal function Implements \Drupal\ckeditor\Plugin\CKEditorPluginInterface::isInternal(). Overrides CKEditorPluginInterface::isInternal
LlamaContextual::getFile function Implements \Drupal\ckeditor\Plugin\CKEditorPluginInterface::getFile(). Overrides Llama::getFile
LlamaContextual::isEnabled function Implements \Drupal\ckeditor\Plugin\CKEditorPluginContextualInterface::isEnabled(). Overrides CKEditorPluginContextualInterface::isEnabled
PluginBase::$configuration protected property Configuration information passed into the plugin. 1
PluginBase::$pluginDefinition protected property The plugin implementation definition.
PluginBase::$pluginId protected property The plugin_id.
PluginBase::getPluginDefinition public function Returns the definition of the plugin implementation. Overrides PluginInspectionInterface::getPluginDefinition
PluginBase::getPluginId public function Returns the plugin_id of the plugin instance. Overrides PluginInspectionInterface::getPluginId
PluginBase::__construct public function Constructs a Drupal\Component\Plugin\PluginBase object. 17