All pastes #498701 Raw Edit

Miscellany

public php v1 · immutable
·published 2007-05-20 16:53 UTC
rendered paste body
function cck_taxonomy_token_list($type, $object = NULL) {  if ($type == 'field' || $type == 'all') {    $result = db_query("SELECT type_name, label FROM {node_field_instance} WHERE widget_type LIKE 'cck_taxonomy_%'");    while ($row = db_fetch_object($result)) {      // this will make an array like $tokens['cck_taxonomy']['field_huba-story'] = First term from Hubacious      $tokens['cck_taxonomy'][$row->type_name] = t('First term from @label', array('@label' => $row->label));    }    return $tokens;  }}function cck_taxonomy_token_values($type, $object = NULL) {  if ($type == 'field') {    $item = $object[0];    // I assume I need to return $tokens['field_huba-story'] = $item['view']    $tokens['field_huba-story'] = $item['view'];    return $tokens;  }}