menu_helper_reset_tree_page_data

custom/menu_helper/menu_helper_reset/menu_helper_reset.module, line 100

Versions
6
menu_helper_reset_tree_page_data($menu_name)

Get the data structure representing a named menu tree, based on the current page with any reset branches re-positioned.

The initial tree is built from menu_tree_page_data.

▾ 1 function calls menu_helper_reset_tree_page_data()

menu_helper_reset_tree in custom/menu_helper/menu_helper_reset/menu_helper_reset.module
Render a menu tree based on the current path with menu item reset to selected reset depths.

Code

<?php
function menu_helper_reset_tree_page_data($menu_name) {
  $tree = menu_tree_page_data($menu_name);

  // Recurse and prune reset_branches
  $reset_branches = _menu_helper_reset_get_reset_branches_recursive($tree);

  // Recurse and place reset_branches
  $keys = array_keys($reset_branches);
  foreach ($keys as $reset_key) {
    // If depth is set to new menu and there are links below then reset navigation
    if ($reset_branches[$reset_key]['link']['options']['menu_helper_reset']['depth'] == MENU_HELPER_RESET_NEW && $reset_branches[$reset_key]['below']) {
      // Set home item. This settings is used by theme_menu_helper_submenu_back($menu_item, $settings).
      _menu_helper_set_home_menu_item( $reset_branches[$reset_key]['link'] );
      // Now completely reset the tree
      $tree = $reset_branches[$reset_key]['below'];
    }
    else {
      _menu_helper_reset_place_reset_branch_recursive($tree, $reset_branches[$reset_key]);
    }
  }
  return $tree;
}
?>