3 namespace Drupal\ckeditor_test\Plugin\CKEditorPlugin;
5 use Drupal\ckeditor\CKEditorPluginContextualInterface;
6 use Drupal\editor\Entity\Editor;
9 * Defines a "Llama" plugin, with a contextually enabled "llama" feature.
12 * id = "llama_contextual",
13 * label = @Translation("Contextual Llama")
16 class LlamaContextual extends Llama implements CKEditorPluginContextualInterface {
21 public function isEnabled(Editor $editor) {
22 // Automatically enable this plugin if the Underline button is enabled.
23 $settings = $editor->getSettings();
24 foreach ($settings['toolbar']['rows'] as $row) {
25 foreach ($row as $group) {
26 if (in_array('Strike', $group['items'])) {
37 public function getFile() {
38 return drupal_get_path('module', 'ckeditor_test') . '/js/llama_contextual.js';