--- token_node.inc~ 2009-10-19 17:24:52.863250000 +1300 +++ token_node.inc 2009-10-27 12:16:51.224625000 +1300 @@ -82,20 +82,24 @@ function node_token_values($type, $objec $trail[] = check_plain($title); } - $values['menupath'] = implode('/', $trail); - $values['menupath-raw'] = implode('/', $trail_raw); - $values['menu'] = check_plain($menu); - $values['menu-raw'] = $menu; - $values['menu-link-title'] = check_plain($menu_link['title']); - $values['menu-link-title-raw'] = $menu_link['link_title']; + $values['menupath'] = implode('/', $trail); + $values['menupath-raw'] = implode('/', $trail_raw); + $values['title-or-menupath'] = $values['menupath']; + $values['title-or-menupath-raw'] = $values['menupath-raw']; + $values['menu'] = check_plain($menu); + $values['menu-raw'] = $menu; + $values['menu-link-title'] = check_plain($menu_link['title']); + $values['menu-link-title-raw'] = $menu_link['link_title']; } else { - $values['menu'] = ''; - $values['menu-raw'] = ''; - $values['menupath'] = ''; - $values['menupath-raw'] = ''; - $values['menu-link-title'] = ''; - $values['menu-link-title-raw'] = ''; + $values['menu'] = ''; + $values['menu-raw'] = ''; + $values['menupath'] = ''; + $values['menupath-raw'] = ''; + $values['title-or-menupath'] = $values['title']; + $values['title-or-menupath-raw'] = $values['title-raw']; + $values['menu-link-title'] = ''; + $values['menu-link-title-raw'] = ''; } // And now taxonomy, which is a bit more work. This code is adapted from @@ -208,12 +212,14 @@ function node_token_list($type = 'all') $tokens['node']['d'] = t("Node creation day (one or two digit)"); $tokens['node']['mod-????'] = t('All tokens for node creation dates can also be used with with the "mod-" prefix; doing so will use the modification date rather than the creation date.'); - $tokens['node']['menu'] = t("The name of the menu the node belongs to."); - $tokens['node']['menu-raw'] = t("The name of the menu the node belongs to. WARNING - raw user input."); - $tokens['node']['menupath'] = t("The menu path (as reflected in the breadcrumb), not including Home or [menu]. Separated by /."); - $tokens['node']['menupath-raw'] = t("The unfiltered menu path (as reflected in the breadcrumb), not including Home or [menu]. Separated by /. WARNING - raw user input."); - $tokens['node']['menu-link-title'] = t("The text used in the menu as link text for this item."); - $tokens['node']['menu-link-title-raw'] = t("The unfiltered text used in the menu as link text for this item. WARNING - raw user input."); + $tokens['node']['menu'] = t("The name of the menu the node belongs to."); + $tokens['node']['menu-raw'] = t("The name of the menu the node belongs to. WARNING - raw user input."); + $tokens['node']['menupath'] = t("The menu path (as reflected in the breadcrumb), not including Home or [menu]. Separated by /."); + $tokens['node']['menupath-raw'] = t("The unfiltered menu path (as reflected in the breadcrumb), not including Home or [menu]. Separated by /. WARNING - raw user input."); + $tokens['node']['title-or-menupath'] = t("Equivalent to [menupath] if a menu item is defined, and [title] otherwise."); + $tokens['node']['title-or-menupath-raw'] = t("Equivalent to [menupath-raw] if a menu item is define, and [title-raw] otherwise. WARNING - raw user input."); + $tokens['node']['menu-link-title'] = t("The text used in the menu as link text for this item."); + $tokens['node']['menu-link-title-raw'] = t("The unfiltered text used in the menu as link text for this item. WARNING - raw user input."); return $tokens; }