DrupalEntity.php in Entity Embed 8
File
src/Plugin/CKEditorPlugin/DrupalEntity.php
View source
<?php
namespace Drupal\entity_embed\Plugin\CKEditorPlugin;
use Drupal\ckeditor\CKEditorPluginCssInterface;
use Drupal\editor\Entity\Editor;
use Drupal\embed\EmbedButtonInterface;
use Drupal\embed\EmbedCKEditorPluginBase;
class DrupalEntity extends EmbedCKEditorPluginBase implements CKEditorPluginCssInterface {
protected function getButton(EmbedButtonInterface $embed_button) {
$button = parent::getButton($embed_button);
$button['entity_type'] = $embed_button
->getTypeSetting('entity_type');
return $button;
}
public function getFile() {
return drupal_get_path('module', 'entity_embed') . '/js/plugins/drupalentity/plugin.js';
}
public function getLibraries(Editor $editor) {
return [
'core/jquery',
'core/drupal',
'core/drupal.ajax',
];
}
public function getConfig(Editor $editor) {
return [
'DrupalEntity_dialogTitleAdd' => t('Insert entity'),
'DrupalEntity_dialogTitleEdit' => t('Edit entity'),
'DrupalEntity_buttons' => $this
->getButtons(),
];
}
public function getCssFiles(Editor $editor) {
return [
drupal_get_path('module', 'system') . '/css/components/hidden.module.css',
drupal_get_path('module', 'entity_embed') . '/css/entity_embed.editor.css',
];
}
}