public function RouteProcessorCsrf::renderPlaceholderCsrfToken
public RouteProcessorCsrf::renderPlaceholderCsrfToken($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.
File
- core/lib/Drupal/Core/Access/RouteProcessorCsrf.php, line 71
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', ], ], ]; }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Access!RouteProcessorCsrf.php/function/RouteProcessorCsrf::renderPlaceholderCsrfToken/8.1.x