function RouteProcessorCsrf::renderPlaceholderCsrfToken
Same name in other branches
- 9 core/lib/Drupal/Core/Access/RouteProcessorCsrf.php \Drupal\Core\Access\RouteProcessorCsrf::renderPlaceholderCsrfToken()
- 10 core/lib/Drupal/Core/Access/RouteProcessorCsrf.php \Drupal\Core\Access\RouteProcessorCsrf::renderPlaceholderCsrfToken()
- 11.x core/lib/Drupal/Core/Access/RouteProcessorCsrf.php \Drupal\Core\Access\RouteProcessorCsrf::renderPlaceholderCsrfToken()
#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.
File
-
core/
lib/ Drupal/ Core/ Access/ RouteProcessorCsrf.php, line 73
Class
- RouteProcessorCsrf
- Processes the outbound route to handle the CSRF token.
Namespace
Drupal\Core\AccessCode
public function renderPlaceholderCsrfToken($path) {
return [
'#markup' => $this->csrfToken
->get($path),
// Tokens are per session.
'#cache' => [
'contexts' => [
'session',
],
],
];
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.