function ckeditor5_drupalelementstyle_test_ckeditor5_plugin_info_alter

Same name and namespace in other branches
  1. 9 core/modules/ckeditor5/tests/modules/ckeditor5_drupalelementstyle_test/ckeditor5_drupalelementstyle_test.module \ckeditor5_drupalelementstyle_test_ckeditor5_plugin_info_alter()
  2. 10 core/modules/ckeditor5/tests/modules/ckeditor5_drupalelementstyle_test/ckeditor5_drupalelementstyle_test.module \ckeditor5_drupalelementstyle_test_ckeditor5_plugin_info_alter()

Implements hook_ckeditor4to5upgrade_plugin_info_alter().

File

core/modules/ckeditor5/tests/modules/ckeditor5_drupalelementstyle_test/ckeditor5_drupalelementstyle_test.module, line 15

Code

function ckeditor5_drupalelementstyle_test_ckeditor5_plugin_info_alter(array &$plugin_definitions) : void {
    // Update `media_mediaAlign`.
    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);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.