I have created a List (text) field that has key|label pairs as options. How do I get the label, when the key is what is stored in the node?

1 Answer 1


This was my solution:

  if (isset($node->field_k_status[LANGUAGE_NONE][0]['value'])) {
    $info = (field_info_field('field_k_status'));
    $status =  $info['settings']['allowed_values'][$node->field_k_status[LANGUAGE_NONE][0]['value']];
  } else {
    $status = "Not Set";

At this point, $status will have the label of whatever field_k_status is set to. field_info_field() gets the details about the field, and $node->field_k_status[LANGUAGE_NONE][0]['value'] gets the value. I think that there is likely a better way, but I couldn't find it. There is a somewhat similar question asked here, but I didn't find what I was looking for anywhere else.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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