EmojioneCKEditorButton.php in CKEditor Emojione 8
File
src/Plugin/CKEditorPlugin/EmojioneCKEditorButton.php
View source
<?php
namespace Drupal\ckeditor_emojione\Plugin\CKEditorPlugin;
use Drupal\ckeditor\CKEditorPluginBase;
use Drupal\editor\Entity\Editor;
class EmojioneCKEditorButton extends CKEditorPluginBase {
public function getButtons() {
$path = $this
->getLibraryPath();
return [
'Emojione' => [
'label' => t('Emoji ckeditor button'),
'image' => $path . '/icons/emojione.png',
],
];
}
public function getFile() {
$path = $this
->getLibraryPath();
return $path . '/plugin.js';
}
public function getConfig(Editor $editor) {
return [];
}
protected function getLibraryPath() {
if (\Drupal::moduleHandler()
->moduleExists('libraries')) {
return \Drupal::service('library.libraries_directory_file_finder')
->find('emojione');
}
return 'libraries/emojione';
}
}