-1

is there a way to get the label of a value from a select field? I mean that if my select field has options like:

key1|label1 Key2|label2

how can I get label1 in my node--*.tpl.php?

Thanks.

1

You can use list_allowed_values().

$field = field_info_field('field_name');
$allowed_values = list_allowed_values($field);

For reference field_info_field()

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.