Drupal select list key in template file

223 views Asked by At

How would I go about getting the key of a select list field in a view template (Row style output)?

The field is added to my view and hidden from display. It contains stuff like:

red|Red
green|Green
blue|Blue

How can I get the selected key (ie. red) for the field in the template?

I was able to print it using:

$view->field['field_color']->view->result[0]->field_field_color[0]['raw']['value']

but I wonder if there is an easier way to get that key.

Thanks in advance.

1

There are 1 answers

0
progzy On BEST ANSWER
$row->field_field_color[0]['raw']['value'];