function hook_ckeditor5_plugin_info_alter
Same name in other branches
- 9 core/modules/ckeditor5/ckeditor5.api.php \hook_ckeditor5_plugin_info_alter()
- 11.x core/modules/ckeditor5/ckeditor5.api.php \hook_ckeditor5_plugin_info_alter()
Modify the list of available CKEditor 5 plugins.
This hook may be used to modify plugin properties after they have been specified by other modules.
Parameters
array $plugin_definitions: An array of all the existing plugin definitions, passed by reference.
See also
\Drupal\ckeditor5\Plugin\CKEditor5PluginManager
Related topics
2 functions implement hook_ckeditor5_plugin_info_alter()
Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.
- ckeditor5_drupalelementstyle_test_ckeditor5_plugin_info_alter in core/
modules/ ckeditor5/ tests/ modules/ ckeditor5_drupalelementstyle_test/ ckeditor5_drupalelementstyle_test.module - Implements hook_ckeditor4to5upgrade_plugin_info_alter().
- ckeditor5_test_module_allowed_image_ckeditor5_plugin_info_alter in core/
modules/ ckeditor5/ tests/ modules/ ckeditor5_test_module_allowed_image/ ckeditor5_test_module_allowed_image.module - Implements hook_ckeditor5_plugin_info_alter().
1 invocation of hook_ckeditor5_plugin_info_alter()
- CKEditor5PluginManager::__construct in core/
modules/ ckeditor5/ src/ Plugin/ CKEditor5PluginManager.php - Constructs a CKEditor5PluginManager object.
File
-
core/
modules/ ckeditor5/ ckeditor5.api.php, line 246
Code
function hook_ckeditor5_plugin_info_alter(array &$plugin_definitions) : void {
// Add a link decorator to the link plugin.
assert($plugin_definitions['ckeditor5_link'] instanceof CKEditor5PluginDefinition);
$link_plugin_definition = $plugin_definitions['ckeditor5_link']->toArray();
$link_plugin_definition['ckeditor5']['config']['link']['decorators'][] = [
'mode' => 'manual',
'label' => t('Open in new window'),
'attributes' => [
'target' => '_blank',
],
];
$plugin_definitions['ckeditor5_link'] = new CKEditor5PluginDefinition($link_plugin_definition);
// Add a custom file type to the image upload plugin. Note that 'tiff' below
// should be an IANA image media type Name, with the "image/" prefix omitted.
// In other words: a subtype of type image.
// @see https://www.iana.org/assignments/media-types/media-types.xhtml#image
// @see https://ckeditor.com/docs/ckeditor5/latest/api/module_image_imageconfig-ImageUploadConfig.html#member-types
assert($plugin_definitions['ckeditor5_imageUpload'] instanceof CKEditor5PluginDefinition);
$image_upload_plugin_definition = $plugin_definitions['ckeditor5_imageUpload']->toArray();
$image_upload_plugin_definition['ckeditor5']['config']['image']['upload']['types'][] = 'tiff';
$plugin_definitions['ckeditor5_imageUpload'] = new CKEditor5PluginDefinition($image_upload_plugin_definition);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.