You are here

function power_menu_get_breadcrumbs in Power Menu 7

Same name and namespace in other branches
  1. 6 power_menu.module \power_menu_get_breadcrumbs()
  2. 7.2 power_menu.module \power_menu_get_breadcrumbs()

Set Breadcrumbs based on active menu trail. I borrowed this function from the menutrails module

2 calls to power_menu_get_breadcrumbs()
power_menu_init in ./power_menu.module
Implements hook_init().
power_menu_node_view in ./power_menu.module
Implements hook_node_view().

File

./power_menu.module, line 386
This module provides some additional menu features. The features are not actually new, but are part of other modules. it's though very cumbersome to creating a new menu item, because one has to go to all the different places to configure these…

Code

function power_menu_get_breadcrumbs() {
  $item = menu_get_item();

  // Give first priority to the selected menu.
  $menu = power_menu_get_menu();
  if (!$menu) {
    $menu = db_query("SELECT menu_name FROM {menu_links} WHERE link_path = :link_path AND module = :module", array(
      ':link_path' => $item['href'],
      ':module' => 'menu',
    ))
      ->fetchField();
  }
  $tree = menu_tree_page_data($menu);
  $crumbs = array(
    l(t('Home'), '<front>'),
  );
  _power_menu_recurse_crumbs($tree, $item, $crumbs);
  return $crumbs;
}