CookieContentBlocker.php in Cookie Content Blocker 8
File
src/Plugin/CKEditorPlugin/CookieContentBlocker.php
View source
<?php
namespace Drupal\cookie_content_blocker\Plugin\CKEditorPlugin;
use Drupal\ckeditor\CKEditorPluginBase;
use Drupal\ckeditor\CKEditorPluginCssInterface;
use Drupal\editor\Entity\Editor;
class CookieContentBlocker extends CKEditorPluginBase implements CKEditorPluginCssInterface {
protected $modulePath;
public function __construct(array $configuration, $plugin_id, $plugin_definition) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->modulePath = drupal_get_path('module', 'cookie_content_blocker');
}
public function getCssFiles(Editor $editor) : array {
return [
$this->modulePath . '/js/plugins/cookiecontentblocker/css/editor.css',
];
}
public function getFile() : string {
return $this->modulePath . '/js/plugins/cookiecontentblocker/plugin.js';
}
public function getConfig(Editor $editor) : array {
return [];
}
public function getButtons() : array {
return [
'CookieContentBlocker' => [
'label' => $this
->t('Add Cookie Content Blocker content'),
'image' => $this->modulePath . '/js/plugins/cookiecontentblocker/icons/cookiecontentblocker.png',
],
];
}
}