diff --git a/core/includes/theme.inc b/core/includes/theme.inc index f136ca1..392020a 100644 --- a/core/includes/theme.inc +++ b/core/includes/theme.inc @@ -975,7 +975,7 @@ function template_preprocess_links(&$variables) { $variables['links'] = array(); foreach ($links as $key => $link) { - $item = array(); + $item = array('key' => $key); $link += array( 'href' => NULL, 'route_name' => NULL, @@ -983,10 +983,6 @@ function template_preprocess_links(&$variables) { 'ajax' => NULL, ); - $li_attributes = array('class' => array()); - // Use the array key as class name. - $li_attributes['class'][] = drupal_html_class($key); - $keys = array('title', 'href', 'route_name', 'route_parameters'); $link_element = array( '#type' => 'link', @@ -1000,6 +996,7 @@ function template_preprocess_links(&$variables) { // Handle links and ensure that the active class is added on the LIs, but // only if the 'set_active_class' option is not empty. + $li_attributes = array(); if (isset($link['href']) || isset($link['route_name'])) { if (!empty($variables['set_active_class'])) { diff --git a/core/modules/system/src/Tests/Theme/FunctionsTest.php b/core/modules/system/src/Tests/Theme/FunctionsTest.php index c8d068c..c5200af 100644 --- a/core/modules/system/src/Tests/Theme/FunctionsTest.php +++ b/core/modules/system/src/Tests/Theme/FunctionsTest.php @@ -273,13 +273,13 @@ function testLinks() { $variables['set_active_class'] = TRUE; $expected_links = ''; $expected_links .= '