diff --git a/core/includes/theme.inc b/core/includes/theme.inc index 61e4de14b2dfb4d1829436ce18587c168e5fa543..c1ce5eb114357ee579139c1d513227d8cc134c64 100644 --- a/core/includes/theme.inc +++ b/core/includes/theme.inc @@ -1267,8 +1267,8 @@ function template_preprocess_html(&$variables) { // Construct page title. if (!empty($variables['page']['#title'])) { $head_title = array( - 'title' => SafeMarkup::set(trim(strip_tags($variables['page']['#title']))), - 'name' => SafeMarkup::checkPlain($site_config->get('name')), + 'title' => trim(strip_tags($variables['page']['#title'])), + 'name' => $site_config->get('name'), ); } // @todo Remove once views is not bypassing the view subscriber anymore. @@ -1276,24 +1276,19 @@ function template_preprocess_html(&$variables) { elseif ($is_front_page) { $head_title = array( 'title' => t('Home'), - 'name' => SafeMarkup::checkPlain($site_config->get('name')), + 'name' => $site_config->get('name'), ); } else { - $head_title = array('name' => SafeMarkup::checkPlain($site_config->get('name'))); + $head_title = ['name' => $site_config->get('name')]; if ($site_config->get('slogan')) { - $head_title['slogan'] = strip_tags(Xss::filterAdmin($site_config->get('slogan'))); + $head_title['slogan'] = strip_tags($site_config->get('slogan')); } } + $variables['head_title'] = $head_title; + // @deprecated in Drupal 8.0.0, will be removed before Drupal 9.0.0. $variables['head_title_array'] = $head_title; - $output = ''; - $separator = ''; - foreach ($head_title as $item) { - $output .= $separator . SafeMarkup::escape($item); - $separator = ' | '; - } - $variables['head_title'] = SafeMarkup::set($output); // Collect all attachments. This must happen in the preprocess function for // #type => html, to ensure that attachments added in #pre_render callbacks @@ -1491,11 +1486,8 @@ function template_preprocess_install_page(&$variables) { // Override the site name that is displayed on the page, since Drupal is // still in the process of being installed. - $distribution_name = SafeMarkup::checkPlain(drupal_install_profile_distribution_name()); + $distribution_name = drupal_install_profile_distribution_name(); $variables['site_name'] = $distribution_name; - $variables['head_title_array']['name'] = $distribution_name; - - $variables['head_title'] = implode(' | ', $variables['head_title_array']); } /** diff --git a/core/modules/system/templates/html.html.twig b/core/modules/system/templates/html.html.twig index 94785426e5970be13babd4cff09e2a01e8018cc3..50fa76f371eec6ae63c6b5557760f34bf2113f91 100644 --- a/core/modules/system/templates/html.html.twig +++ b/core/modules/system/templates/html.html.twig @@ -10,9 +10,8 @@ * - css: A list of CSS files for the current page. * - head: Markup for the HEAD element (including meta tags, keyword tags, and * so on). - * - head_title: A modified version of the page title, for use in the TITLE tag. - * - head_title_array: List of text elements that make up the head_title - * variable. May contain or more of the following: + * - head_title: List of text elements that make up the head_title variable. + * May contain or more of the following: * - title: The title of the page. * - name: The name of the site. * - slogan: The slogan of the site. @@ -34,7 +33,7 @@ {{ head }} - {{ head_title }} + {{ head_title|safe_join(' | ') }} {{ styles }} {{ scripts }} diff --git a/core/themes/classy/templates/layout/html.html.twig b/core/themes/classy/templates/layout/html.html.twig index b01961833471a1a94675c96b00f06a46c6ab9ae2..34c8c568df254c9c8092294a699c3ff91ae6fab5 100644 --- a/core/themes/classy/templates/layout/html.html.twig +++ b/core/themes/classy/templates/layout/html.html.twig @@ -10,9 +10,8 @@ * - css: A list of CSS files for the current page. * - head: Markup for the HEAD element (including meta tags, keyword tags, and * so on). - * - head_title: A modified version of the page title, for use in the TITLE tag. - * - head_title_array: List of text elements that make up the head_title - * variable. May contain or more of the following: + * - head_title: List of text elements that make up the head_title variable. + * May contain or more of the following: * - title: The title of the page. * - name: The name of the site. * - slogan: The slogan of the site. @@ -40,7 +39,7 @@ {{ head }} - {{ head_title }} + {{ head_title|safe_join(' | ') }} {{ styles }} {{ scripts }}