stable.theme 634 B

12345678910111213141516171819202122232425
  1. <?php
  2. /**
  3. * @file
  4. * Functions to support theming in the Stable theme.
  5. */
  6. use Drupal\Component\Utility\Html;
  7. /**
  8. * Implements template_preprocess_links().
  9. */
  10. function stable_preprocess_links(&$variables) {
  11. // @deprecated in Drupal 8.0.x and will be removed before 9.0.0. This feature
  12. // of adding a class based on the associative key can cause CSS class name
  13. // conflicts.
  14. if (!empty($variables['links'])) {
  15. foreach ($variables['links'] as $key => $value) {
  16. if (!is_numeric($key)) {
  17. $class = Html::getClass($key);
  18. $variables['links'][$key]['attributes']->addClass($class);
  19. }
  20. }
  21. }
  22. }