class RouteProcessorCsrf implements OutboundRouteProcessorInterface, TrustedCallbackInterface (View source)

Processes the outbound route to handle the CSRF token.

Properties

protected CsrfTokenGenerator $csrfToken

The CSRF token generator.

Methods

__construct(CsrfTokenGenerator $csrf_token)

Constructs a RouteProcessorCsrf object.

The
processOutbound(string $route_name, Route $route, array $parameters, BubbleableMetadata $bubbleable_metadata = NULL)

Processes the outbound route.

array
renderPlaceholderCsrfToken(string $path)

lazy_builder callback; gets a CSRF token for the given path.

static string[]
trustedCallbacks()

Lists the trusted callbacks provided by the implementing class.

Details

__construct(CsrfTokenGenerator $csrf_token)

Constructs a RouteProcessorCsrf object.

Parameters

CsrfTokenGenerator $csrf_token

The CSRF token generator.

The processOutbound(string $route_name, Route $route, array $parameters, BubbleableMetadata $bubbleable_metadata = NULL)

Processes the outbound route.

Parameters

string $route_name

The route name.

Route $route

The outbound route to process.

array $parameters

An array of parameters to be passed to the route compiler. Passed by reference.

BubbleableMetadata $bubbleable_metadata

(optional) Object to collect route processors' bubbleable metadata.

Return Value

The

processed path.

array renderPlaceholderCsrfToken(string $path)

lazy_builder callback; gets a CSRF token for the given path.

Parameters

string $path

The path to get a CSRF token for.

Return Value

array

A renderable array representing the CSRF token.

static string[] trustedCallbacks()

Lists the trusted callbacks provided by the implementing class.

Trusted callbacks are public methods on the implementing class and can be invoked via \Drupal\Core\Security\DoTrustedCallbackTrait::doTrustedCallback().

Return Value

string[]

List of method names implemented by the class that can be used as trusted callbacks.