diff --git a/core/includes/theme.inc b/core/includes/theme.inc index 723ae63..2ff894c 100644 --- a/core/includes/theme.inc +++ b/core/includes/theme.inc @@ -978,16 +978,13 @@ function template_preprocess_links(&$variables) { $variables['links'] = array(); foreach ($links as $key => $link) { - $item = array(); + $item = array('link_key' => $key); $link += array( 'ajax' => NULL, 'url' => NULL, ); - $li_attributes = array('class' => array()); - // Use the array key as class name. - $li_attributes['class'][] = drupal_html_class($key); - + $li_attributes = array(); $keys = ['title', 'url']; $link_element = array( '#type' => 'link', diff --git a/core/modules/system/src/Tests/Theme/FunctionsTest.php b/core/modules/system/src/Tests/Theme/FunctionsTest.php index 6433a64..f9a4a83 100644 --- a/core/modules/system/src/Tests/Theme/FunctionsTest.php +++ b/core/modules/system/src/Tests/Theme/FunctionsTest.php @@ -271,11 +271,11 @@ function testLinks() { $expected_links .= ''; $expected = $expected_heading . $expected_links; $this->assertThemeOutput('links', $variables, $expected); diff --git a/core/modules/system/templates/links.html.twig b/core/modules/system/templates/links.html.twig index 3823c22..5d1555a 100644 --- a/core/modules/system/templates/links.html.twig +++ b/core/modules/system/templates/links.html.twig @@ -15,6 +15,7 @@ * not be passed through \Drupal\Component\Utility\String::checkPlain(). * - attributes: (optional) HTML attributes for the anchor, or for the * tag if no 'href' is supplied. + * - link_key: The link CSS class. * - heading: (optional) A heading to precede the links. * - text: The heading text. * - level: The heading level (e.g. 'h2', 'h3'). @@ -45,7 +46,7 @@ {%- endif -%} {%- for item in links -%} - + {%- if item.link -%} {{ item.link }} {%- elseif item.text_attributes -%}