You are here

function content_token_values in Token 5

File

./token_cck.inc, line 5

Code

function content_token_values($type, $object = NULL, $options = array()) {
  $tokens = array();
  if ($type == 'node') {
    $node = $object;
    content_view($node, isset($options['teaser']) ? $options['teaser'] : 0);
    $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;
          }
        }
      }
    }
  }
  return $tokens;
}