You are here

function hook_ckeditor5_plugin_info_alter in Drupal 10

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

1 function implements 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().
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 244
Documentation related to CKEditor 5.

Code

function hook_ckeditor5_plugin_info_alter(array &$plugin_definitions) : void {
  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);
}