diff --git a/core/includes/theme.inc b/core/includes/theme.inc index 69c9e05..aa17773 100644 --- a/core/includes/theme.inc +++ b/core/includes/theme.inc @@ -18,6 +18,7 @@ use Drupal\Core\Utility\ThemeRegistry; use Drupal\Core\Theme\ThemeSettings; use Drupal\Component\Utility\NestedArray; +use Drupal\Component\Utility\MapArray; /** * @defgroup content_flags Content markers @@ -1641,8 +1642,6 @@ function template_preprocess_status_messages(&$variables) { * http://www.w3.org/TR/WCAG-TECHS/H42.html for more information. */ function theme_links($variables) { - $language_url = language(Language::TYPE_URL); - $links = $variables['links']; $attributes = $variables['attributes']; $heading = $variables['heading']; @@ -1698,7 +1697,7 @@ function theme_links($variables) { $link_element = array( '#type' => 'link', '#title' => $link['title'], - '#options' => array_diff_key($link, drupal_map_assoc(array('title', 'href', 'ajax'))), + '#options' => array_diff_key($link, MapArray::copyValuesToKeys(array('title', 'href', 'route_name', 'route_parameters'))), '#href' => $link['href'], '#route_name' => $link['route_name'], '#route_parameters' => $link['route_parameters'], @@ -1724,6 +1723,7 @@ function theme_links($variables) { $item = drupal_render($link_element); } elseif (isset($link['href'])) { + $language_url = language(Language::TYPE_URL); $is_current_path = ($link['href'] == current_path() || ($link['href'] == '' && drupal_is_front_page())); $is_current_language = (empty($link['language']) || $link['language']->id == $language_url->id); if ($is_current_path && $is_current_language) { diff --git a/core/modules/system/lib/Drupal/system/Tests/Theme/FunctionsTest.php b/core/modules/system/lib/Drupal/system/Tests/Theme/FunctionsTest.php index 051ac08..7c0ac6f 100644 --- a/core/modules/system/lib/Drupal/system/Tests/Theme/FunctionsTest.php +++ b/core/modules/system/lib/Drupal/system/Tests/Theme/FunctionsTest.php @@ -177,7 +177,7 @@ function testLinks() { $expected_links .= ''; @@ -210,7 +210,7 @@ function testLinks() { $expected_links .= ''; $expected = $expected_heading . $expected_links;