Glyphicons.php in CKEditor Bootstrap Glyphicon 8
File
src/Plugin/CKEditorPlugin/Glyphicons.php
View source
<?php
namespace Drupal\glyphicons\Plugin\CKEditorPlugin;
use Drupal\ckeditor\CKEditorPluginBase;
use Drupal\ckeditor\CKEditorPluginCssInterface;
use Drupal\editor\Entity\Editor;
class Glyphicons extends CKEditorPluginBase implements CKEditorPluginCssInterface {
public static function getLibraryPath() {
return \Drupal::service('library.libraries_directory_file_finder')
->find('glyphicons');
}
public function getDependencies(Editor $editor) {
return [
'colordialog',
];
}
public function getFile() {
return $this
->getLibraryPath() . '/plugin.js';
}
public function getConfig(Editor $editor) {
return [
'allowedContent' => TRUE,
];
}
public function getCssFiles(Editor $editor) {
return [
$this
->getLibraryPath() . '/css/style.css',
];
}
public function getButtons() {
return [
'Glyphicons' => [
'label' => $this
->t('Glyphicons'),
'image' => $this
->getLibraryPath() . '/icons/glyphicons.png',
],
];
}
public function getLibraries(Editor $editor) {
return [
'glyphicons/glyphicons',
];
}
}