function Contrib::mapCKEditor4ToolbarButtonToCKEditor5ToolbarItem

Same name in other branches
  1. 9 core/modules/ckeditor5/src/Plugin/CKEditor4To5Upgrade/Contrib.php \Drupal\ckeditor5\Plugin\CKEditor4To5Upgrade\Contrib::mapCKEditor4ToolbarButtonToCKEditor5ToolbarItem()
  2. 11.x core/modules/ckeditor5/src/Plugin/CKEditor4To5Upgrade/Contrib.php \Drupal\ckeditor5\Plugin\CKEditor4To5Upgrade\Contrib::mapCKEditor4ToolbarButtonToCKEditor5ToolbarItem()

Overrides CKEditor4To5UpgradePluginInterface::mapCKEditor4ToolbarButtonToCKEditor5ToolbarItem

File

core/modules/ckeditor5/src/Plugin/CKEditor4To5Upgrade/Contrib.php, line 38

Class

Contrib
Provides the CKEditor 4 to 5 upgrade path for contrib plugins now in core.

Namespace

Drupal\ckeditor5\Plugin\CKEditor4To5Upgrade

Code

public function mapCKEditor4ToolbarButtonToCKEditor5ToolbarItem(string $cke4_button, HTMLRestrictions $text_format_html_restrictions) : ?array {
    switch ($cke4_button) {
        // @see https://www.drupal.org/project/codetag
        case 'Code':
            return [
                'code',
            ];
        // @see https://www.drupal.org/project/codesnippet
        case 'CodeSnippet':
            return [
                'codeBlock',
            ];
        default:
            throw new \OutOfBoundsException();
    }
}

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