You are here

function power_menu_init in Power Menu 7

Implements hook_init().

here we are going to invoke hook_power_menu_href a possible implementation of it, could look as followed:

function rapsli_power_menu_href($menu_item) { $ar_active = array('my_path' => 'my_path/*'); foreach ($ar_active as $key => $pattern) { if (drupal_match_path($menu_item['href'], $pattern)) { return $key; } } }

File

./power_menu.module, line 154
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_init() {
  $item = menu_get_item();
  $result = module_invoke_all('power_menu_href', $item);
  if (is_array($result)) {
    $href = array_pop($result);
    if (!empty($href)) {
      $item['href'] = $href;
      menu_set_item(NULL, $item);
      $breadcrumbs = power_menu_get_breadcrumbs();
      if (variable_get('power_menu_breadcrumb_title', FALSE)) {
        $breadcrumbs[] = $node->title;
      }
      drupal_set_breadcrumb($breadcrumbs);
    }
  }
}