Created
September 9, 2014 14:26
-
-
Save timrobertson100/a1c5ba457f7dd8588d4b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Detect the URLs with the ISO code, and ensure the tab is highlighted | |
if (isset($variables['page']['menu']['menu_block_gbif_navigation_analytics'])) { | |
$current_path = explode('/', current_path()); | |
// e.g. analytics/country/<ISO>/about or analytics/country/<ISO>/published | |
if (count($current_path) == 4) { | |
// items where registered in menu without the ISO | |
$menu_item = $current_path[0] . '/' . $current_path[1] . '/' . $current_path[3]; | |
// find the registered menu item and add the "active" CSS class to the attributes | |
foreach ($variables['page']['menu']['menu_block_gbif_navigation_analytics']['#content'] as $k => $tab) { | |
if (gettype($k) == 'integer') { | |
if ($tab['#href'] == $menu_item) { | |
watchdog('analytics', 'setting it!', array(), WATCHDOG_DEBUG); | |
// make it active | |
array_push($variables['page']['menu']['menu_block_gbif_navigation_analytics']['#content'][$k]['#attributes']['class'], "active"); | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment