function Ckeditor5TestModuleAllowedImageHooks::ckeditor5PluginInfoAlter

Same name and namespace in other branches
  1. 11.x core/modules/ckeditor5/tests/modules/ckeditor5_test_module_allowed_image/src/Hook/Ckeditor5TestModuleAllowedImageHooks.php \Drupal\ckeditor5_test_module_allowed_image\Hook\Ckeditor5TestModuleAllowedImageHooks::ckeditor5PluginInfoAlter()

Implements hook_ckeditor5_plugin_info_alter().

Attributes

#[Hook('ckeditor5_plugin_info_alter')]

File

core/modules/ckeditor5/tests/modules/ckeditor5_test_module_allowed_image/src/Hook/Ckeditor5TestModuleAllowedImageHooks.php, line 18

Class

Ckeditor5TestModuleAllowedImageHooks
Hook implementations for ckeditor5_test_module_allowed_image.

Namespace

Drupal\ckeditor5_test_module_allowed_image\Hook

Code

public function ckeditor5PluginInfoAlter(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.