Loop trough a list of referenced nodes in order to get a specific field value I am using Computed Field to get some values;

I have a Template node that holds an Entity Reference multivalues field to a series of other nodes, all referenced nodes of the same type. The referenced nodes have a text field which value I need to get.

Until now I've managed to get the "target_id" of the referenced nodes, but I can't manage to get the values:

$tpl = field_get_items($entity_type, $entity, 'field_plan_tpl_select_trainings');
$nids = array();

foreach ($tpl as $field_item) {
            $nids[] = $field_item['target_id'];
}


What is the next step in order to get the values of a specific field for all the referenced nodes? I mention that the field has only one value.
the "target_id" is the nid (node id) of the referenced entity, now if you want to get the values of a specific field of the referenced entities you can do the following:

$values = array();

foreach($tpl as $field_item){
$values[] = node_load($field_item['target_id'])-&gt;field_your_field;
}


you just need to load the entity and then get the field you are looking for. Devel module will make your life easier in that purpose

If the entity you are referencing is not a "node" so you can load the entity using entity_load() and then use entity_metadata_wrapper() for get the fields and all the info you need from each entity.