You are here

function power_menu_get_breadcrumbs in Power Menu 7.2

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

Constructs the breadcrumb for given path. This works only, when the path is used in e menu link.

Parameters

$path: The system path to get the breadcrumb for.

Return value

The populated breadcrumb array.

1 call to power_menu_get_breadcrumbs()
power_menu_set_path in ./power_menu.module
Sets the system path to use for the active menu trail.

File

./power_menu.module, line 378

Code

function power_menu_get_breadcrumbs($path) {
  $crumbs = array(
    l(t('Home'), '<front>'),
  );
  $menu = db_select('menu_links', 'ml')
    ->fields('ml', array(
    'menu_name',
  ))
    ->condition('ml.link_path', $path, '=')
    ->execute()
    ->fetchField();
  if ($menu) {
    $tree = menu_tree_page_data($menu);

    // Use translated menu items
    if (function_exists('i18n_menu_localize_tree')) {
      $tree = i18n_menu_localize_tree($tree);
    }
    _power_menu_recurse_crumbs($tree, $path, $crumbs);
  }
  return $crumbs;
}