Updated to Drupal 8.6.4, which is PHP 7.3 friendly. Also updated HTMLaw library....
[yaffs-website] / web / core / modules / ckeditor / tests / modules / src / Plugin / CKEditorPlugin / LlamaContextual.php
1 <?php
2
3 namespace Drupal\ckeditor_test\Plugin\CKEditorPlugin;
4
5 use Drupal\ckeditor\CKEditorPluginContextualInterface;
6 use Drupal\editor\Entity\Editor;
7
8 /**
9  * Defines a "Llama" plugin, with a contextually enabled "llama" feature.
10  *
11  * @CKEditorPlugin(
12  *   id = "llama_contextual",
13  *   label = @Translation("Contextual Llama")
14  * )
15  */
16 class LlamaContextual extends Llama implements CKEditorPluginContextualInterface {
17
18   /**
19    * {@inheritdoc}
20    */
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'])) {
27           return TRUE;
28         }
29       }
30     }
31     return FALSE;
32   }
33
34   /**
35    * {@inheritdoc}
36    */
37   public function getFile() {
38     return drupal_get_path('module', 'ckeditor_test') . '/js/llama_contextual.js';
39   }
40
41 }