toolbar_in_active_trail
function toolbar_in_active_trail
toolbar_in_active_trail($path)
Checks whether an item is in the active trail.
Useful when using a menu generated by menu_tree_all_data() which does not set the 'in_active_trail' flag on items.
@todo Look at migrating to a menu system level function.
Return value
TRUE when path is in the active trail, FALSE if not.
File
- modules/toolbar/toolbar.module, line 349
- Administration toolbar for quick access to top level administration items.
Code
function toolbar_in_active_trail($path) { $active_paths = &drupal_static(__FUNCTION__); // Gather active paths. if (!isset($active_paths)) { $active_paths = array(); $trail = menu_get_active_trail(); foreach ($trail as $item) { if (!empty($item['href'])) { $active_paths[] = $item['href']; } } } return in_array($path, $active_paths); }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/modules!toolbar!toolbar.module/function/toolbar_in_active_trail/7.x