I am trying to check the type of multi value field is a field_collection_item or not inside computed field using this code:

$wrapper = entity_metadata_wrapper($entity_type, $entity);  
$fields_info = $wrapper->getPropertyInfo();  
foreach ($fields_info as $req_field) {

  if ($req_field['type']=='field_collection_item') {  
    //do something here

The if statement failed as $req_field['type'] returns list<field_collection_item>.

Any ideas?

1 Answer 1


That's how an EntityMetadataWrapper stores multiple fields. There are only those two types, so just use

if($req_field['type'] == 'field_collection_item' || $req_field['type'] == 'list<field_collection_item>') {  
  // So something here

Or some variation on that.

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.