You are here

public function ImageUpload::getDynamicPluginConfig in Drupal 10

File

core/modules/ckeditor5/src/Plugin/CKEditor5Plugin/ImageUpload.php, line 56

Class

ImageUpload
CKEditor 5 Image plugin.

Namespace

Drupal\ckeditor5\Plugin\CKEditor5Plugin

Code

public function getDynamicPluginConfig(array $static_plugin_config, EditorInterface $editor) : array {
  return $static_plugin_config + [
    'drupalImageUpload' => [
      'uploadUrl' => self::getUrlWithReplacedCsrfTokenPlaceholder(Url::fromRoute('ckeditor5.upload_image')
        ->setRouteParameter('editor', $editor
        ->getFilterFormat()
        ->id())),
      'withCredentials' => TRUE,
      'headers' => [
        'Accept' => 'application/json',
        'text/javascript',
      ],
    ],
  ];
}