Commit 74d41a80 authored by hass's avatar hass

Issue #1828018 by hass: Duplicate 'active' classes are added if it's the

current page or views tabs
parent 455fd011
......@@ -239,10 +239,14 @@ function context_preprocess_menu_link(&$variables) {
$menu_paths = array_intersect($urls, array($menu_name, 'context-reaction-menu-bc-layer'));
$reaction_menu_paths = array_keys($menu_paths);
// If menu href and context reaction menu url match, add the 'active' css
// class to the link of this menu.
if (in_array($variables['element']['#href'], $reaction_menu_paths)) {
$variables['element']['#localized_options']['attributes']['class'][] = 'active';
// - If menu href and context reaction menu url match, add the 'active'
// css class to the link of this menu.
// - Do not add class twice on current page.
if (in_array($variables['element']['#href'], $reaction_menu_paths) && $variables['element']['#href'] != $_GET['q']) {
// Do not add the 'active' class twice in views tabs.
if (!in_array('active', $variables['element']['#localized_options']['attributes']['class'])) {
$variables['element']['#localized_options']['attributes']['class'][] = 'active';
}
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment