public ToolbarController::subtreesAjax()
Returns an AJAX response to render the toolbar subtrees.
Return value
\Drupal\Core\Ajax\AjaxResponse
File
- core/modules/toolbar/src/Controller/ToolbarController.php, line 21
Class
- ToolbarController
- Defines a controller for the toolbar module.
Namespace
Drupal\toolbar\Controller
Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | public function subtreesAjax() { list( $subtrees , $cacheability ) = toolbar_get_rendered_subtrees(); $response = new AjaxResponse(); $response ->addCommand( new SetSubtreesCommand( $subtrees )); // The Expires HTTP header is the heart of the client-side HTTP caching. The // additional server-side page cache only takes effect when the client // accesses the callback URL again (e.g., after clearing the browser cache // or when force-reloading a Drupal page). $max_age = 365 * 24 * 60 * 60; $response ->setPrivate(); $response ->setMaxAge( $max_age ); $expires = new \DateTime(); $expires ->setTimestamp(REQUEST_TIME + $max_age ); $response ->setExpires( $expires ); return $response ; } |
Please login to continue.