ckeditor5_drupalelementstyle_test.module

Same filename and directory in other branches
  1. 9 core/modules/ckeditor5/tests/modules/ckeditor5_drupalelementstyle_test/ckeditor5_drupalelementstyle_test.module
  2. 10 core/modules/ckeditor5/tests/modules/ckeditor5_drupalelementstyle_test/ckeditor5_drupalelementstyle_test.module

File

core/modules/ckeditor5/tests/modules/ckeditor5_drupalelementstyle_test/ckeditor5_drupalelementstyle_test.module

View source
<?php


/**
 * @file
 * Implements hooks for the CKEditor 5 Drupal Element Style Test module.
 */
declare (strict_types=1);
use Drupal\ckeditor5\Plugin\CKEditor5PluginDefinition;

/**
 * Implements hook_ckeditor4to5upgrade_plugin_info_alter().
 */
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);
}

Functions

Title Deprecated Summary
ckeditor5_drupalelementstyle_test_ckeditor5_plugin_info_alter Implements hook_ckeditor4to5upgrade_plugin_info_alter().

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