You are here

function token_menu_link_get_parents_all in Token 6

Find all ancestors of a given menu link ID.

Parameters

$mlid: A menu link ID.

Return value

An array of menu links from token_menu_link_load() with the root link first, and the menu link with ID $mlid last.

3 calls to token_menu_link_get_parents_all()
book_token_values in ./token_node.inc
Implements hook_token_values() on behalf of book.module.
menu_token_values in ./token_node.inc
Implements hook_token_values() on behalf of menu.module.
_menu_titles in ./token.module
Deprecated. Use the raw return value of token_menu_link_get_parents_all() instead.

File

./token.module, line 938
The Token API module.

Code

function token_menu_link_get_parents_all($mlid) {
  $parents = array();
  while (!empty($mlid)) {
    $link = token_menu_link_load($mlid);
    array_unshift($parents, $link);
    $mlid = $link['plid'];
  }
  return $parents;
}