Index: token.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/token/token.module,v
retrieving revision 1.5.2.12
diff -u -u -r1.5.2.12 token.module
--- token.module	17 Jan 2008 10:46:16 -0000	1.5.2.12
+++ token.module	25 Mar 2008 20:28:25 -0000
@@ -5,21 +5,26 @@
  * For a given context, builds a formatted list of tokens and descriptions
  * of their replacement values.
  *
- * @param type
- *    The token types to display documentation for. Defaults to 'all'.
+ * @param types
+ *    The token types to display documentation for. The special type 'all' can
+ *    be used as shorthand to retrieve help for all tokens. Defaults to 
+ *    array('global').
  * @param prefix
  *    The prefix your module will use when parsing tokens. Defaults to '['
  * @param suffix
  *    The suffix your module will use when parsing tokens. Defaults to ']'
  * @return An HTML table containing the formatting docs.
  **/
-function theme_token_help($type = 'all', $prefix = '[', $suffix = ']') {
+function token_help($types = array('global'), $prefix = '[', $suffix = ']') {
   token_include();
-  $full_list = token_get_list($type);
-  
+  $tokens = token_get_list($types);
+  return theme('token_help', $tokens, $prefix, $suffix);  
+}
+
+function theme_token_help($tokens, $prefix = '[', $suffix = ']') {
   $headers = array(t('Token'), t('Replacement value'));
   $rows = array();
-  foreach ($full_list as $key => $category) {
+  foreach ($tokens as $key => $category) {
     $rows[] = array(array('data' => drupal_ucfirst($key) . ' ' . t('tokens'), 'class' => 'region', 'colspan' => 2));
     foreach ($category as $token => $description) {
       $row = array();
@@ -268,30 +273,27 @@
  * A helper function that retrieves all currently exposed tokens,
  * and merges them recursively. This is only necessary when building
  * the token listing -- during actual value replacement, only tokens
- * in a particular domain are requested and a normal array_marge() is
+ * in a particular domain are requested and a normal array_merge() is
  * sufficient.
  *
- * @param type
- *   A flag indicating the class of substitution tokens to use. If an
- *   object is passed in the second param, 'type' should contain the
- *   object's type. For example, 'node', 'comment', or 'user'. If no
- *   type is specified, only 'global' site-wide substitution tokens are
- *   built.
+ * @param types
+ *   An array of the classes of substitution tokens to use. The special type
+ *   all can be used to return a list of all tokens. 
+ *   are specified all potential tokens will be returned.
+ *
  * @return
  *   The array of usable tokens and their descriptions, organized by
  *   token type.
  */
-function token_get_list($type = 'all') {
+function token_get_list($types = array('global')) {
   token_include();
   $return = array();
   foreach (module_implements('token_list') as $module) {
     $function = $module .'_token_list';
-    $result = $function($type);
-    if (is_array($result)) {
-      foreach ($result as $category => $tokens) {
-        foreach ($tokens as $token => $title) {
-          $return[$category][$token] = $title;
-        }
+    foreach($types as $type) {
+      $result = $function($type);
+      if (is_array($result)) {
+        $return = array_merge_recursive($return, $result);
       }
     }
   }
