Templates.php in Wysiwyg API template plugin 8.2
File
src/Plugin/CKEditorPlugin/Templates.php
View source
<?php
namespace Drupal\wysiwyg_template\Plugin\CKEditorPlugin;
use Drupal\ckeditor\CKEditorPluginInterface;
use Drupal\Core\Config\ConfigFactoryInterface;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\Core\Plugin\PluginBase;
use Drupal\editor\Entity\Editor;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\RequestStack;
class Templates extends PluginBase implements CKEditorPluginInterface, ContainerFactoryPluginInterface {
protected $config;
protected $requestStack;
public function __construct(array $configuration, $plugin_id, $plugin_definition, ConfigFactoryInterface $config_factory, RequestStack $request_stack) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->config = $config_factory
->get('wysiwyg_template.settings');
$this->requestStack = $request_stack;
}
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
return new static($configuration, $plugin_id, $plugin_definition, $container
->get('config.factory'), $container
->get('request_stack'));
}
public function isInternal() : bool {
return FALSE;
}
public function getDependencies(Editor $editor) : array {
return [];
}
public function getLibraries(Editor $editor) : array {
return [];
}
public function getFile() : string {
return $this->config
->get('library_path') . '/plugin.js';
}
public function getConfig(Editor $editor) : array {
return [];
}
}
Classes
Name |
Description |
Templates |
Defines the CKEditor Templates plugin. |