Index: token_cck.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/token/token_cck.inc,v
retrieving revision 1.1.2.11
diff -u -r1.1.2.11 token_cck.inc
--- token_cck.inc	28 Jun 2008 15:09:33 -0000	1.1.2.11
+++ token_cck.inc	5 Aug 2008 22:57:42 -0000
@@ -3,25 +3,28 @@
 
 
 // Two helper functions that generate appropriate tokens for CCK-added fields.
-function content_token_values($type, $object = NULL, $options = array()) {
+function content_token_values($type, $object = NULL) {
   $tokens = array();
   if ($type == 'node') {
     $node = $object;
-    content_view($node, isset($options['teaser']) ? $options['teaser'] : 0);
+    $node->build_mode = 'token_values';
+    $node->content = array();
+    content_view($node);
+    // The formatted values will only be known after the content has been rendered.
+    drupal_render($node->content);
+    content_alter($node);
 
     $field_types = _content_field_types();
-
-    foreach (content_fields() as $field) {
-      
-      $items = $node->$field['field_name'];
-      if (!empty($items)) {
-        $function = $field_types[$field['type']]['module'] .'_token_values';
-        if (function_exists($function)) {
-          $sub_list = $function('field', $items);
-          foreach ($sub_list as $token => $value) {
-            $tokens[$field['field_name'] .'-'. $token] = $value;
-          }
+    $type = content_types($node->type);
+    foreach ($type['fields'] as $field) {
+      $items = $node->{$field['field_name']};
+      $function = $field_types[$field['type']]['module'] . '_token_values';
+      if (!empty($items) && function_exists($function)) {
+        $token_values = $function('field', $items);
+        foreach($token_values as $token => $value) {
+          $tokens[$field['field_name'] .'-'. $token] = $value;
         }
+
       }
     }
   }
@@ -35,7 +38,7 @@
 
     foreach (content_fields() as $field) {
       $sub_list = array();
-      $function = $field_types[$field['type']]['module'] .'_token_list';
+      $function = $field_types[$field['type']]['module'] . '_token_list';
       if (function_exists($function)) {
         $sub_list = $function('field');
         foreach ($sub_list as $category => $token_list) {
@@ -50,49 +53,49 @@
   }
 }
 
-
-
 if (module_exists('nodereference')) {
   function nodereference_token_list($type = 'all') {
     if ($type == 'field' || $type == 'all') {
       $tokens = array();
 
-      $tokens['node reference']['nid']   = t("Referenced node ID.");
-      $tokens['node reference']['title'] = t("Referenced node title.");
-      $tokens['node reference']['link']  = t("Formatted html link to the node.");
+      $tokens['node reference']['nid']   = t('Referenced node ID');
+      $tokens['node reference']['title'] = t('Referenced node title');
+      $tokens['node reference']['link']  = t("Formatted html link to the referenced node.");
+      $tokens['node reference']['path']  = t("Relative path alias to the referenced node.");
+      $tokens['node reference']['url']  = t("Absolute path alias to the referenced node.");
 
       return $tokens;
     }
   }
 
-  function nodereference_token_values($type, $object = NULL, $options = array()) {
+  function nodereference_token_values($type, $object = NULL) {
     if ($type == 'field') {
       $item = $object[0];
 
       $tokens['nid']   = $item['nid'];
       $tokens['title'] = strip_tags($item['view']);
       $tokens['link']  = $item['view'];
+      $tokens['path'] = url('node/' . $item['nid']);
+      $tokens['url'] = url('node/' . $item['nid'], array('absolute' => TRUE));
 
       return $tokens;
     }
   }
 }
 
-
-
 if (module_exists('number')) {
   function number_token_list($type = 'all') {
     if ($type == 'field' || $type == 'all') {
       $tokens = array();
 
-      $tokens['number']['raw']       = t("Raw number value.");
-      $tokens['number']['formatted'] = t("Formatted number value.");
+      $tokens['number']['raw']       = t('Raw number value');
+      $tokens['number']['formatted'] = t('Formatted number value');
 
       return $tokens;
     }
   }
 
-  function number_token_values($type, $object = NULL, $options = array()) {
+  function number_token_values($type, $object = NULL) {
     if ($type == 'field') {
       $item = $object[0];
 
@@ -104,23 +107,22 @@
   }
 }
 
-
-
 if (module_exists('text')) {
   function text_token_list($type = 'all') {
     if ($type == 'field' || $type == 'all') {
       $tokens = array();
 
-      $tokens['text']['raw']       = t("Raw, unfiltered text.");
-      $tokens['text']['formatted'] = t("Formatted and filtered text.");
+      $tokens['text']['raw']       = t('Raw, unfiltered text');
+      $tokens['text']['formatted'] = t('Formatted and filtered text');
 
       return $tokens;
     }
   }
 
-  function text_token_values($type, $object = NULL, $options = array()) {
+  function text_token_values($type, $object = NULL) {
     if ($type == 'field') {
       $item = $object[0];
+
       $tokens['raw']  = $item['value'];
       $tokens['formatted'] = $item['view'];
       return $tokens;
@@ -128,27 +130,30 @@
   }
 }
 
-
 if (module_exists('userreference')) {
   function userreference_token_list($type = 'all') {
     if ($type == 'field' || $type == 'all') {
       $tokens = array();
 
-      $tokens['user reference']['uid']   = t("Referenced user ID");
-      $tokens['user reference']['name']  = t("Referenced user name");
-      $tokens['user reference']['link']  = t("Formatted html link to referenced user");
+      $tokens['user reference']['uid']   = t('Referenced user ID');
+      $tokens['user reference']['name']  = t('Referenced user name');
+      $tokens['user reference']['link']  = t('Formatted HTML link to referenced user');
+      $tokens['user reference']['path']  = t("Relative path alias to the referenced user.");
+      $tokens['user reference']['url']  = t("Absolute path alias to the referenced user.");
 
       return $tokens;
     }
   }
 
-  function userreference_token_values($type, $object = NULL, $options = array()) {
+  function userreference_token_values($type, $object = NULL) {
     if ($type == 'field') {
       $item = $object[0];
 
       $tokens['uid']   = $item['uid'];
       $tokens['name']  = strip_tags($item['view']);
       $tokens['link']  = $item['view'];
+      $tokens['path'] = url('user/' . $item['uid']);
+      $tokens['url'] = url('user/' . $item['uid'], array('absolute' => TRUE));
 
       return $tokens;
     }
