Index: token.test =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/token/token.test,v retrieving revision 1.1.2.21 diff -u -p -r1.1.2.21 token.test --- token.test 13 Dec 2010 22:13:44 -0000 1.1.2.21 +++ token.test 13 Dec 2010 22:26:43 -0000 @@ -382,13 +382,15 @@ class TokenMenuTestCase extends TokenTes $tokens = array( 'menu' => 'Primary links', 'menu-raw' => 'Primary links', + 'menupath' => 'Root link/Parent link/Node link', + 'menupath-raw' => 'Root link/Parent link/Node link', 'menu-link-title' => 'Node link', 'menu-link-title-raw' => 'Node link', 'menu-link-mlid' => $node->menu['mlid'], 'menu-link-plid' => $node->menu['plid'], 'menu-link-plid' => $parent_link['mlid'], - 'menupath' => 'Root link/Parent link/Node link', - 'menupath-raw' => 'Root link/Parent link/Node link', + 'menu-link-parent-path' => 'root/parent', + 'menu-link-parent-path-raw' => 'root/parent', ); $this->assertTokens('node', $node, $tokens); } @@ -441,11 +443,12 @@ class TokenBookTestCase extends TokenTes // Check that even those book menu links have been created for this node, // that the menu links still return nothing. 'menu' => '', + 'menupath' => '', 'menu-link-title' => '', 'menu-link-title-raw' => '', 'menu-link-mlid' => '', 'menu-link-plid' => '', - 'menupath' => '', + 'menu-link-parent-path' => '', ); $this->assertTokens('node', $parent_node, $tokens); Index: token_node.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/token/Attic/token_node.inc,v retrieving revision 1.5.4.36 diff -u -p -r1.5.4.36 token_node.inc --- token_node.inc 13 Dec 2010 21:52:28 -0000 1.5.4.36 +++ token_node.inc 13 Dec 2010 22:26:43 -0000 @@ -193,6 +193,8 @@ function menu_token_list($type = 'all') $tokens['node']['menu-link-title-raw'] = t("The unfiltered text used in the menu as link text for this item."); $tokens['node']['menu-link-mlid'] = t("The unique ID of the node's menu link."); $tokens['node']['menu-link-plid'] = t("The unique ID of the node's menu link parent."); + $tokens['node']['menu-link-parent-path'] = t("The URL alias of the parent menu link of the node."); + $tokens['node']['menu-link-parent-path-raw'] = t("The URL alias of the parent menu link of the node."); } return $tokens; @@ -216,6 +218,8 @@ function menu_token_values($type, $objec $values['menu-link-title-raw'] = ''; $values['menu-link-mlid'] = ''; $values['menu-link-plid'] = ''; + $values['menu-link-parent-path'] = ''; + $values['menu-link-parent-path-raw'] = ''; if (!isset($node->menu)) { // Nodes do not have their menu links loaded via menu_nodeapi($node, 'load'). @@ -242,7 +246,12 @@ function menu_token_values($type, $objec $values['menu-link-title'] = check_plain($menu_link['title']); $values['menu-link-title-raw'] = $menu_link['title']; $values['menu-link-mlid'] = $menu_link['mlid']; - $values['menu-link-plid'] = $menu_link['plid']; + + if (!empty($menu_link['plid']) && $parent = token_menu_link_load($menu_link['plid'])) { + $values['menu-link-plid'] = $parent['mlid']; + $values['menu-link-parent-path-raw'] = drupal_get_path_alias($parent['href']); + $values['menu-link-parent-path'] = check_plain($values['menu-link-parent-path-raw']); + } } }