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