You are here

private static function DynamicPluginConfigWithCsrfTokenUrlTrait::getUrlWithReplacedCsrfTokenPlaceholder in Drupal 10

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.

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')
    ->renderPlain($url_with_csrf_token_placeholder);
}