Skip to content
Snippets Groups Projects

Backport

42 files
+ 1049
213
Compare changes
  • Side-by-side
  • Inline
Files
42
+ 24
5
@@ -1320,11 +1320,30 @@ function template_preprocess_html(&$variables) {
$variables['page']['#title'] = (string) \Drupal::service('renderer')->render($variables['page']['#title']);
}
if (!empty($variables['page']['#title'])) {
$head_title = [
// Marking the title as safe since it has had the tags stripped.
'title' => Markup::create(trim(strip_tags($variables['page']['#title']))),
'name' => $site_config->get('name'),
];
$head_title = [];
// Marking the title as safe since it has had the tags stripped.
$head_title['title'] = Markup::create(trim(strip_tags($variables['page']['#title'])));
$maintenance_mode = defined('MAINTENANCE_MODE') || \Drupal::state()->get('system.maintenance_mode');
if (!$maintenance_mode) {
$base_route_title = \Drupal::service('base_route_title_resolver')->getTitle(\Drupal::requestStack()->getCurrentRequest(), \Drupal::routeMatch()->getRouteObject());
if (is_array($base_route_title)) {
$base_route_title = (string) \Drupal::service('renderer')->render($base_route_title);
}
if ($base_route_title) {
// Marking the title as safe since it has had the tags stripped.
$base_route_title = Markup::create(trim(strip_tags($base_route_title)));
// If the base route title is not the same as the current title, append it
// to the head title.
if ((string) $base_route_title !== (string) $head_title['title']) {
$head_title['base_route_title'] = $base_route_title;
}
}
}
$head_title['name'] = $site_config->get('name');
}
// @todo Remove once views is not bypassing the view subscriber anymore.
// @see https://www.drupal.org/node/2068471
Loading