function ckeditor5_test_module_allowed_image_ckeditor5_plugin_info_alter

Implements hook_ckeditor5_plugin_info_alter().

File

core/modules/ckeditor5/tests/modules/ckeditor5_test_module_allowed_image/ckeditor5_test_module_allowed_image.module, line 13

Code

function ckeditor5_test_module_allowed_image_ckeditor5_plugin_info_alter(array &$plugin_definitions) : void {
    // Add a custom file type to the image upload plugin. Note that 'svg+xml'
    // below should be an IANA image media type Name, with the "image/" prefix
    // omitted. In other words: a subtype of type image.
    // @see https://www.iana.org/assignments/media-types/media-types.xhtml#image
    // @see https://ckeditor.com/docs/ckeditor5/latest/api/module_image_imageconfig-ImageUploadConfig.html#member-types
    $image_upload_plugin_definition = $plugin_definitions['ckeditor5_imageUpload']->toArray();
    $image_upload_plugin_definition['ckeditor5']['config']['image']['upload']['types'][] = 'svg+xml';
    $plugin_definitions['ckeditor5_imageUpload'] = new CKEditor5PluginDefinition($image_upload_plugin_definition);
}

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