CkeditorBootstrapTable.php in CKEditor Bootstrap Table 8
File
src/Plugin/CKEditorPlugin/CkeditorBootstrapTable.php
View source
<?php
namespace Drupal\ckeditor_bootstrap_table\Plugin\CKEditorPlugin;
use Drupal\editor\Entity\Editor;
use Drupal\ckeditor\CKEditorPluginBase;
use Drupal\ckeditor\CKEditorPluginInterface;
use Drupal\ckeditor\CKEditorPluginContextualInterface;
class CkeditorBootstrapTable extends CKEditorPluginBase implements CKEditorPluginInterface, CKEditorPluginContextualInterface {
public function getPluginPath() {
return drupal_get_path('module', 'ckeditor_bootstrap_table') . '/js/plugins/bt_table';
}
public function isInternal() {
return FALSE;
}
public function getFile() {
return $this
->getPluginPath() . '/plugin.js';
}
public function getLibraries(Editor $editor) {
return [];
}
public function isEnabled(Editor $editor) {
if (!$editor
->hasAssociatedFilterFormat()) {
return FALSE;
}
$settings = $editor
->getSettings();
if (!empty($settings)) {
foreach ($settings['toolbar']['rows'] as $row) {
foreach ($row as $group) {
foreach ($group['items'] as $button) {
if ($button === 'Table') {
return TRUE;
}
}
}
}
}
return FALSE;
}
public function getButtons() {
return [];
}
public function getConfig(Editor $editor) {
return [];
}
}