Hi there --
So I'm pulling back a list of nodes and their fields. One of them is a text field that uses a single-select as its widget. Although I know that the key is what's stored in the database, given the widget I'd expect Views to return that key's label when showing me the content of that field for a given node. Instead, I get the key. Is there a best practice, either in the GUI, in template files, or in a module, for translating this into the select field's labels?
Thanks for this awesome module!
Ben
Comments
Comment #1
damiankloip commentedWhat are you trying to do with this data? When a form is posted, the key is what you would get as a value - That's pretty standard I would say. You would need to either store some of your data on the form so you can lookup again based on the id, or just load the entity again?
Comment #2
esmerel commentedComment #3
manjirik commentedYou can try this.
$key = 0; // Or whatever
$field = field_info_field('field_priority');
$label = $field['settings']['allowed_values'][$key];
Comment #4
manjirik commented