1 ckeditor5.api.php hook_ckeditor5_upgrade_button_mapping()

Specify the button mapping used between CKEditor 4 and CKEditor 5 upgrades.

Any module that provided custom buttons in CKEditor 4 should implement this hook to control what happens to that button during a CKEditor 5 text format upgrade.

At the very least, it's probable that the capitalization of the button will change. CKEditor 4 buttons were usually Pascal-case (such as "RemoveFormat"), while CKEditor 5 buttons are usually camel-case (such as "removeFormat").

Return value

array: An array of key-value pairs of strings.

See also

ckeditor5_upgrade_format()

hook_ckeditor5_upgrade_button_mapping_alter()

Related topics

File

core/modules/ckeditor5/ckeditor5.api.php, line 190
Documentation for CKEditor module APIs.

Code

function hook_ckeditor5_upgrade_button_mapping() {
  return array(
    // The key is the CKEditor 4 button name, while the value is the CKEditor 5
    // button name.
    'Maximize' => 'maximize',
    // A value of NULL will remove the button during the upgrade process.
    'Cut' => NULL,
    'Copy' => NULL,
    'Paste' => NULL,
  );
}