You are here

function menu_position_precache_tree in Menu Position 6

Places a menu tree cache in place of the original router item's tree.

1 call to menu_position_precache_tree()
menu_position_evaluate_rules in ./menu_position.module
Evaluates all rules based on the given path.

File

./menu_position.module, line 274
Provides menu links for dynamic positioning of nodes based on configurable rules.

Code

function menu_position_precache_tree($router_item, $original_router_item, $menu_name) {

  // Create a menu tree using the menu_position path.
  menu_tree_page_data($menu_name);

  // Get the cache for the tree we just generated.
  $router_item_cid = 'links:' . $menu_name . ':page-cid:' . $router_item['href'] . ':' . (int) $router_item['access'];
  $cache = cache_get($router_item_cid, 'cache_menu');
  $tree_cid = $cache->data;

  // Copy the cache to the tree that contains the original router item.
  $original_router_item_cid = 'links:' . $menu_name . ':page-cid:' . $original_router_item['href'] . ':' . (int) $original_router_item['access'];
  cache_set($original_router_item_cid, $tree_cid, 'cache_menu');
}