Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?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