public function ColorButton::getConfig in CKEditor Color Button 8
Returns the additions to CKEDITOR.config for a specific CKEditor instance.
The editor's settings can be retrieved via $editor->getSettings(), but be aware that it may not yet contain plugin-specific settings, because the user may not yet have configured the form. If there are plugin-specific settings (verify with isset()), they can be found at
$settings = $editor
->getSettings();
$plugin_specific_settings = $settings['plugins'][$plugin_id];
Parameters
\Drupal\editor\Entity\Editor $editor: A configured text editor object.
Return value
array A keyed array, whose keys will end up as keys under CKEDITOR.config.
Overrides CKEditorPluginInterface::getConfig
File
- src/
Plugin/ CKEditorPlugin/ ColorButton.php, line 56
Class
- ColorButton
- Defines the "colorbutton" plugin.
Namespace
Drupal\colorbutton\Plugin\CKEditorPluginCode
public function getConfig(Editor $editor) {
$settings = $editor
->getSettings();
// enableMore can only be supported if the Color Dialog plugin is present.
$config = [
'colorButton_enableMore' => FALSE,
'colorButton_enableAutomatic' => TRUE,
];
if (!empty($settings['plugins']['colorbutton']['colors'])) {
$config['colorButton_colors'] = $settings['plugins']['colorbutton']['colors'];
}
return $config;
}