Checking for existence for a field on an an entity_metadata_wrapper 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-&gt;field_contributor-&gt;field_contrib_headshot-&gt;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.
Simply call the PHP function isset():

$headshot = array();
if (isset($item_wrapper-&gt;field_contributor-&gt;field_contrib_headshot)) {
  $headshot = $item_wrapper-&gt;field_contributor-&gt;field_contrib_headshot-&gt;value();
}


EntityStructureWrapper implements the __isset() function according the principe of Overloading.