function _advanced_menu_submenu_cache in Advanced Menu 7
Helper function to update menu cache for block display.
1 call to _advanced_menu_submenu_cache()
- advanced_menu_submenu_block_view_alter in submenu/
advanced_menu_submenu.module - Implements hook_block_view_alter().
File
- submenu/
advanced_menu_submenu.module, line 167 - Provides advanced menu submenus.
Code
function _advanced_menu_submenu_cache($cache_key) {
$cache = cache_get($cache_key, 'cache_menu');
if ($cache && isset($cache->data)) {
//Update the menu cache if needed.
foreach ($cache->data['menu'] as $key => $menu) {
$cache->data['menu'][$key] = _advanced_menu_submenu_cache_recursive($menu);
}
cache_set($cache_key, $cache->data, 'cache_menu');
}
else {
//Build the menu cache.
$cache = array();
$cache['menu'] = menu_tree_all_data($menu_name);
foreach ($cache['menu'] as $key => $menu) {
$cache['menu'][$key] = _advanced_menu_submenu_cache_recursive($menu);
}
cache_set($cache_key, $cache, 'cache_menu');
}
}