2a6fa14b95db68b2fc3c5760383569e2bcd32cec
[yaffs-website] / web / modules / contrib / entity_embed / src / Plugin / CKEditorPlugin / DrupalEntity.php
1 <?php
2
3 namespace Drupal\entity_embed\Plugin\CKEditorPlugin;
4
5 use Drupal\editor\Entity\Editor;
6 use Drupal\embed\EmbedButtonInterface;
7 use Drupal\embed\EmbedCKEditorPluginBase;
8
9 /**
10  * Defines the "drupalentity" plugin.
11  *
12  * @CKEditorPlugin(
13  *   id = "drupalentity",
14  *   label = @Translation("Entity"),
15  *   embed_type_id = "entity"
16  * )
17  */
18 class DrupalEntity extends EmbedCKEditorPluginBase {
19
20   /**
21    * {@inheritdoc}
22    */
23   protected function getButton(EmbedButtonInterface $embed_button) {
24     $button = parent::getButton($embed_button);
25     $button['entity_type'] = $embed_button->getTypeSetting('entity_type');
26     return $button;
27   }
28
29   /**
30    * {@inheritdoc}
31    */
32   public function getFile() {
33     return drupal_get_path('module', 'entity_embed') . '/js/plugins/drupalentity/plugin.js';
34   }
35
36   /**
37    * {@inheritdoc}
38    */
39   public function getConfig(Editor $editor) {
40     return array(
41       'DrupalEntity_dialogTitleAdd' => t('Insert entity'),
42       'DrupalEntity_dialogTitleEdit' => t('Edit entity'),
43       'DrupalEntity_buttons' => $this->getButtons(),
44     );
45   }
46
47 }