CkeditorTableResize.php in CKEditor Table Resize 8
File
src/Plugin/CKEditorPlugin/CkeditorTableResize.php
View source
<?php
namespace Drupal\ckeditor_tableresize\Plugin\CKEditorPlugin;
use Drupal\Core\Plugin\PluginBase;
use Drupal\editor\Entity\Editor;
use Drupal\ckeditor\CKEditorPluginInterface;
use Drupal\ckeditor\CKEditorPluginContextualInterface;
class CkeditorTableResize extends PluginBase implements CKEditorPluginInterface, CKEditorPluginContextualInterface {
public function isInternal() {
return FALSE;
}
private function getPluginPath() {
return 'libraries/tableresize';
}
public function getFile() {
return $this
->getPluginPath() . '/plugin.js';
}
public function isEnabled(Editor $editor) {
if (!$editor
->hasAssociatedFilterFormat()) {
return FALSE;
}
$format = $editor
->getFilterFormat();
if ($format
->filters('filter_align')->status || $format
->filters('filter_caption')->status) {
$settings = $editor
->getSettings();
foreach ($settings['toolbar']['rows'] as $row) {
foreach ($row as $group) {
foreach ($group['items'] as $button) {
if ($button === 'Table') {
return TRUE;
}
}
}
}
}
return FALSE;
}
public function getLibraries(Editor $editor) {
return [];
}
public function getConfig(Editor $editor) {
return [];
}
public function getDependencies(Editor $editor) {
return [];
}
public function getButtons() {
return [];
}
}