function umami_preprocess_links
Same name in other branches
- 9 core/profiles/demo_umami/themes/umami/umami.theme \umami_preprocess_links()
- 11.x core/profiles/demo_umami/themes/umami/umami.theme \umami_preprocess_links()
Implements template_preprocess_links().
This makes it so array keys of #links items are added as a class. This functionality was removed in Drupal 8.1, but still necessary in some instances.
@todo remove in https://drupal.org/node/3120962
File
-
core/
profiles/ demo_umami/ themes/ umami/ umami.theme, line 184
Code
function umami_preprocess_links(&$variables) {
if (!empty($variables['links'])) {
foreach ($variables['links'] as $key => $value) {
if (!is_numeric($key)) {
$class = Html::getClass($key);
$variables['links'][$key]['attributes']->addClass($class);
}
}
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.