1 ckeditor5.api.php hook_ckeditor5_upgrade_format_alter(&$format, $original_format)

Modify a text format when it is upgraded from CKEditor 4 to CKEditor 5.

This can be used to modify CKEditor settings that have changed structure between CKEditor 4 and CKEditor 5.


stdClass $format: The text format after it has been upgraded to CKEditor 5. This object is modified by reference.

stdClass $original_format: The text format before it was upgraded to CKEditor 5.

See also


Related topics


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


function hook_ckeditor5_upgrade_format_alter(&$format, $original_format) {
  if (isset($format->editor_settings['plugins']['my_plugin'])) {
    // Remove the additional nesting that was present in CKEditor 4 config.
    $format->editor_settings['my_plugin'] = $format->editor_settings['plugins']['my_plugin'];

    // Be sure to remove any settings that have been converted.