You are here

function context_reaction_menu::set_active_trail_from_link in Context 7.3

Helper function to build and set the active trail from a menu link.

Parameters

$item: A menu link item.

1 call to context_reaction_menu::set_active_trail_from_link()
context_reaction_menu::execute in plugins/context_reaction_menu.inc
Provide active trail in all menus in which our path appears.
1 method overrides context_reaction_menu::set_active_trail_from_link()
context_reaction_breadcrumb::set_active_trail_from_link in plugins/context_reaction_breadcrumb.inc
Overrides set_active_trail_from_link to set the breadcrumb instead of the menu path.

File

plugins/context_reaction_menu.inc, line 109

Class

context_reaction_menu
Expose menu items as context reactions.

Code

function set_active_trail_from_link($item) {
  menu_tree_set_path($item['menu_name'], $item['link_path']);
  $trail = array();
  while ($item) {
    array_unshift($trail, $item);
    $item = menu_link_load($item['plid']);
  }
  array_unshift($trail, array(
    'title' => t('Home'),
    'href' => '<front>',
    'link_path' => '',
    'localized_options' => array(),
    'type' => 0,
  ));
  menu_set_active_trail($trail);
}