ckeditor5_drupalelementstyle_test.module in Drupal 10
File
core/modules/ckeditor5/tests/modules/ckeditor5_drupalelementstyle_test/ckeditor5_drupalelementstyle_test.module
View source
<?php
declare (strict_types=1);
use Drupal\ckeditor5\Plugin\CKEditor5PluginDefinition;
function ckeditor5_drupalelementstyle_test_ckeditor5_plugin_info_alter(array &$plugin_definitions) : void {
assert($plugin_definitions['media_mediaAlign'] instanceof CKEditor5PluginDefinition);
$media_align_plugin_definition = $plugin_definitions['media_mediaAlign']
->toArray();
$media_align_plugin_definition['ckeditor5']['config']['drupalMedia']['toolbar'] = [
0 => [
'name' => 'drupalMedia:align',
'title' => 'Test title',
'display' => 'splitButton',
'items' => array_values(array_filter($media_align_plugin_definition['ckeditor5']['config']['drupalMedia']['toolbar'], function (string $toolbar_item) : bool {
return $toolbar_item !== '|';
})),
'defaultItem' => 'drupalElementStyle:align:breakText',
],
];
$plugin_definitions['media_mediaAlign'] = new CKEditor5PluginDefinition($media_align_plugin_definition);
}