ckeditor5_test_module_allowed_image.module
Same filename in other branches
File
-
core/
modules/ ckeditor5/ tests/ modules/ ckeditor5_test_module_allowed_image/ ckeditor5_test_module_allowed_image.module
View source
<?php
/**
* @file
* A module to add a custom image type for CKEditor 5.
*/
declare (strict_types=1);
use Drupal\ckeditor5\Plugin\CKEditor5PluginDefinition;
/**
* Implements hook_ckeditor5_plugin_info_alter().
*/
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);
}
Functions
Title | Deprecated | Summary |
---|---|---|
ckeditor5_test_module_allowed_image_ckeditor5_plugin_info_alter | Implements hook_ckeditor5_plugin_info_alter(). |
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.