summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorandregriffin2013-03-23 20:35:33 (GMT)
committer andregriffin2013-03-23 20:35:33 (GMT)
commitcc016cca6e2cdc06378eabc17f6dec4a8b2565c9 (patch)
tree73cf6d52f493e3f879b4085571437ad78d5d483f
parenta7e35613b890ef8ff7673d05939b91d6062a43f6 (diff)
Issue #1896674 by generalredneck: Adds class 'active' to li on menu item
-rw-r--r--includes/menu.inc6
1 files changed, 5 insertions, 1 deletions
diff --git a/includes/menu.inc b/includes/menu.inc
index a173b92..6352937 100644
--- a/includes/menu.inc
+++ b/includes/menu.inc
@@ -82,7 +82,11 @@ function bootstrap_menu_link(array $variables) {
// Set dropdown trigger element to # to prevent inadvertant page loading with submenu click
$element['#localized_options']['attributes']['data-target'] = '#';
}
-
+ // Issue #1896674 - On primary navigation menu, class 'active' is not set on active menu item.
+ // @see http://drupal.org/node/1896674
+ if (($element['#href'] == $_GET['q'] || ($element['#href'] == '<front>' && drupal_is_front_page())) && (empty($element['#localized_options']['language']) || $element['#localized_options']['language']->language == $language_url->language)) {
+ $element['#attributes']['class'][] = 'active';
+ }
$output = l($element['#title'], $element['#href'], $element['#localized_options']);
return '<li' . drupal_attributes($element['#attributes']) . '>' . $output . $sub_menu . "</li>\n";
}