Fetching CCK allowed values for display in a template

From ceejayoz

Jump to: navigation, search

CCK stores the keyed value, not the label (i.e. "No" might be stored as "0"). If you need to retrieve the label from the key, this code'll do it:

$field = content_fields('field_name');
$allowed_values = content_allowed_values($field);
$label = $allowed_values[$node->field_name[0]['value']]
Personal tools