I am iterating through a field collection, and wrapping the field collection items with an entity_metadata_wrapper. I would like to check for the existence of field before calling its value
method (which results in an error on fields that do not have a value), but I cannot find a way to do so.
$field_collection_item = field_collection_item_load($id);
$item_wrapper = entity_metadata_wrapper('field_collection_item', $field_collection_item);
// this results in an error if the field_contrib_headshot field is empty
$headshot = $item_wrapper->field_contributor->field_contrib_headshot->value();
My current workaround is to use field_get_items
to see if the field is empty, but i'd love to be able to do this through the metadata wrapper if possible.