Skip to content

Instantly share code, notes, and snippets.

@philwolstenholme
Created January 24, 2017 14:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save philwolstenholme/4cbfdc7f0552b7932fda9452fe7320c8 to your computer and use it in GitHub Desktop.
Save philwolstenholme/4cbfdc7f0552b7932fda9452fe7320c8 to your computer and use it in GitHub Desktop.
<?php
/**
* Implements hook_views_post_render().
*/
function MODULE_NAME_views_post_render($view) {
if ($view->id() !== 'VIEW_ID' && $view->getDisplay()->getPluginId() !== 'page') {
return;
}
$request = \Drupal::request();
if ($route = $request->attributes->get(\Symfony\Cmf\Component\Routing\RouteObjectInterface::ROUTE_OBJECT)) {
$new_title = $view->getTitle();
$route->setDefault('_title', $new_title);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment