You are here

function stable_preprocess_links in Drupal 8

Same name and namespace in other branches
  1. 9 core/themes/stable/stable.theme \stable_preprocess_links()

Implements template_preprocess_links().

File

core/themes/stable/stable.theme, line 29
Functions to support theming in the Stable theme.

Code

function stable_preprocess_links(&$variables) {

  // @deprecated in Drupal 8.0.x and will be removed before 9.0.0. This feature
  // of adding a class based on the associative key can cause CSS class name
  // conflicts.
  if (!empty($variables['links'])) {
    foreach ($variables['links'] as $key => $value) {
      if (!is_numeric($key)) {
        $class = Html::getClass($key);
        $variables['links'][$key]['attributes']
          ->addClass($class);
      }
    }
  }
}