You are here

function views_menu_reference_get_link_path_parents_hierarchy in Views Menu Reference 7

Returns the <$link_path>'s parent menu hierarchy. It describes the mlids in each depth that may be direct (0) or indirect (1..*) parent. The hierarchy is indexed by the depth and may contain the tree items from more than one menu item, because multiple menu items's may belong to one <$link_path>. The depth index consists of a numeric (0..1..2...) and a plus'sed key (0+..1+..2+) which represent the subtree items.

The function is the public variant which makes use of caching to speed things up on a second request.

Parameters

string $link_path:

Return value

array

2 calls to views_menu_reference_get_link_path_parents_hierarchy()
views_menu_reference_handler_argument_current_path::query in includes/views/views_menu_reference_handler_argument_current_path.inc
Add the filtering to the query.
views_menu_reference_handler_filter_path::query in includes/views/views_menu_reference_handler_filter_path.inc
Add the filtering to the query. This is quite complex, because we have to find all matching fields by the given path, which seems to be the best and fastest solution.

File

./views_menu_reference.module, line 32
views_menu_reference module core implementations.

Code

function views_menu_reference_get_link_path_parents_hierarchy($link_path) {
  if (empty($link_path)) {

    // Return empty array if no link given.
    return array();
  }
  $cache_key = 'views_menu_reference_get_link_path_parents_hierarchy:' . $link_path;
  $parents_hierarchy =& drupal_static($cache_key);
  if (!isset($parents_hierarchy)) {
    if ($cache = cache_get($cache_key)) {
      $parents_hierarchy = $cache->data;
    }
    else {
      $parents_hierarchy = _views_menu_reference_get_link_path_parents_hierarchy($link_path);
      cache_set($cache_key, $parents_hierarchy, 'cache');
    }
  }
  return $parents_hierarchy;
}