file menu-link.vars.php

Stub file for "menu_link" theme hook [pre]process functions.

  1. <?php
  2. /**
  3. * @file
  4. * Stub file for "menu_link" theme hook [pre]process functions.
  5. */
  6. /**
  7. * Pre-processes variables for the "menu_link" theme hook.
  8. *
  9. * See theme function for list of available variables.
  10. *
  11. * @param array $variables
  12. * An associative array of variables, passed by reference.
  13. *
  14. * @see bootstrap_menu_link()
  15. * @see theme_menu_link()
  16. *
  17. * @ingroup theme_preprocess
  18. */
  19. function bootstrap_preprocess_menu_link(array &$variables) {
  20. $element = &$variables['element'];
  21. // Determine if the link should be shown as "active" based on the current
  22. // active trail (set by core/contrib modules).
  23. // @see https://www.drupal.org/node/2618828
  24. // @see https://www.drupal.org/node/1896674
  25. if (in_array('active-trail', _bootstrap_get_classes($element)) || ($element['#href'] == '<front>' && drupal_is_front_page())) {
  26. $element['#attributes']['class'][] = 'active';
  27. }
  28. }

Functions

Name Description
bootstrap_preprocess_menu_link Pre-processes variables for the "menu_link" theme hook.