BootstrapTabs.php in CKEditor Bootstrap Tabs 8
File
src/Plugin/CKEditorPlugin/BootstrapTabs.php
View source
<?php
namespace Drupal\ckeditor_bootstrap_tabs\Plugin\CKEditorPlugin;
use Drupal\ckeditor\CKEditorPluginInterface;
use Drupal\ckeditor\CKEditorPluginButtonsInterface;
use Drupal\Component\Plugin\PluginBase;
use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
use Drupal\Core\StringTranslation\StringTranslationTrait;
use Drupal\Core\StringTranslation\TranslationManager;
use Drupal\editor\Entity\Editor;
use Symfony\Component\DependencyInjection\ContainerInterface;
class BootstrapTabs extends PluginBase implements CKEditorPluginInterface, CKEditorPluginButtonsInterface, ContainerFactoryPluginInterface {
use StringTranslationTrait;
protected $modulePath;
public function __construct(array $configuration, $plugin_id, $plugin_definition, TranslationManager $string_translation) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
$this->stringTranslation = $string_translation;
$this->modulePath = drupal_get_path('module', 'ckeditor_bootstrap_tabs');
}
public static function create(ContainerInterface $container, array $configuration, $plugin_id, $plugin_definition) {
return new static($configuration, $plugin_id, $plugin_definition, $container
->get('string_translation'));
}
public function getButtons() {
return [
'bootstrapTabs' => [
'label' => $this
->t('Bootstrap Tabs'),
'image' => $this->modulePath . '/js/plugins/bootstrapTabs/icons/bootstrapTabs.png',
],
];
}
public function isInternal() {
return FALSE;
}
public function getDependencies(Editor $editor) {
return [];
}
public function getLibraries(Editor $editor) {
return [
'ckeditor_bootstrap_tabs/tabs',
];
}
public function getFile() {
return $this->modulePath . '/js/plugins/bootstrapTabs/plugin.js';
}
public function getConfig(Editor $editor) {
return [];
}
}