}/**
* The image toolbar item changed from `uploadImage` to `drupalInsertImage`.
*/
function ckeditor5_post_update_image_toolbar_item(&
$sandbox =
[]) { $config_entity_updater = \Drupal::
classResolver(ConfigEntityUpdater::
class);
$callback =
function DEditor
$editor) { // Only try to update editors using CKEditor 5.
if ($editor->
getEditor() !== 'ckeditor5'
) { return FALSE;
} $needs_update = FALSE;
// Only update if the editor is using the `uploadImage` toolbar item.
$settings =
$editor->
getSettings();
if (is_array($settings['toolbar'
]['items'
]) &&
in_array('uploadImage',
$settings['toolbar'
]['items'
], TRUE
)) { // Replace `uploadImage` with `drupalInsertImage`.
$settings['toolbar'
]['items'
] =
str_replace('uploadImage', 'drupalInsertImage',
$settings['toolbar'
]['items'
]);
// `<img data-entity-uuid data-entity-type>` are implicitly supported when
// uploads are enabled as the attributes are necessary for upload