In my content type i have range field which have two value from and to. i would like to print the from value only through the computed field.The object array looks like this

[object array]

I tried to fetch the form value by using below piece of code but i am not able to get result. Please anyone guide me to achieve this.

$field_items = field_get_items($entity_type, $entity, 'field_range');
$drilldata = $field_items['und']['0']['value'];
$entity_field[0]['value'] = $drilldata->from;

1 Answer 1


field_get_items() takes care of language negotiation for you, so the field value is one level up. e.g.

$field_items = field_get_items($entity_type, $entity, 'field_range');
if (!empty($field_items[0])) {
  $data = $field_items[0]['value']->from;

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.