You are here

function _advanced_menu_submenu_cache_recursive in Advanced Menu 7

Recursive helper function for menu cache.

1 call to _advanced_menu_submenu_cache_recursive()
_advanced_menu_submenu_cache in submenu/advanced_menu_submenu.module
Helper function to update menu cache for block display.

File

submenu/advanced_menu_submenu.module, line 193
Provides advanced menu submenus.

Code

function _advanced_menu_submenu_cache_recursive($menu_item) {
  $new_items = $menu_item;
  if (isset($menu_item['link']) && $menu_item['link']['router_path'] == 'advanced-menus/sub-menus/%') {
    $original_path = explode('/', $menu_item['link']['link_path']);
    $alter_path = array_pop($original_path);
    $original_path = implode('/', $original_path);
    $new_items = menu_tree_all_data($alter_path);
  }
  if (isset($new_items['below'])) {
    $below = array();
    foreach ($new_items['below'] as $key => $menu) {
      if (isset($menu['link']) && $menu['link']['router_path'] == 'advanced-menus/sub-menus/%') {
        $below = _advanced_menu_submenu_cache_recursive($menu);
      }
    }
    if (!empty($below)) {
      $new_items['below'] = $below;
    }
  }
  return $new_items;
}