function DynamicPluginConfigWithCsrfTokenUrlTrait::getUrlWithReplacedCsrfTokenPlaceholder

Same name in other branches
  1. 9 core/modules/ckeditor5/src/Plugin/CKEditor5Plugin/DynamicPluginConfigWithCsrfTokenUrlTrait.php \Drupal\ckeditor5\Plugin\CKEditor5Plugin\DynamicPluginConfigWithCsrfTokenUrlTrait::getUrlWithReplacedCsrfTokenPlaceholder()
  2. 11.x core/modules/ckeditor5/src/Plugin/CKEditor5Plugin/DynamicPluginConfigWithCsrfTokenUrlTrait.php \Drupal\ckeditor5\Plugin\CKEditor5Plugin\DynamicPluginConfigWithCsrfTokenUrlTrait::getUrlWithReplacedCsrfTokenPlaceholder()

Gets the given URL with all placeholders replaced.

Parameters

\Drupal\Core\Url $url: A URL which generates CSRF token placeholders.

Return value

string The URL string, with all placeholders replaced.

2 calls to DynamicPluginConfigWithCsrfTokenUrlTrait::getUrlWithReplacedCsrfTokenPlaceholder()
Image::getDynamicPluginConfig in core/modules/ckeditor5/src/Plugin/CKEditor5Plugin/Image.php
Allows a plugin to modify its static configuration.
Media::getDynamicPluginConfig in core/modules/ckeditor5/src/Plugin/CKEditor5Plugin/Media.php
Allows a plugin to modify its static configuration.

File

core/modules/ckeditor5/src/Plugin/CKEditor5Plugin/DynamicPluginConfigWithCsrfTokenUrlTrait.php, line 43

Class

DynamicPluginConfigWithCsrfTokenUrlTrait
Provides a trait for CKEditor 5 with dynamically generated CSRF token URLs.

Namespace

Drupal\ckeditor5\Plugin\CKEditor5Plugin

Code

private static function getUrlWithReplacedCsrfTokenPlaceholder(Url $url) : string {
    $generated_url = $url->toString(TRUE);
    $url_with_csrf_token_placeholder = [
        '#plain_text' => $generated_url->getGeneratedUrl(),
    ];
    $generated_url->applyTo($url_with_csrf_token_placeholder);
    return (string) \Drupal::service('renderer')->renderInIsolation($url_with_csrf_token_placeholder);
}

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