an entity_metadata_wrapper for a form_content in form alter hook? There a few days ago, someone in this website advised me to use the function entity_metadata_wrapper. Thanks that, I can get and set fields of entity without use heavy code. 

Now, I would like find the equivalent when I use a form_content from an alter form hook. After several google research, I didn't find the equivalent... can you help me ? =)

Concretely, When I get a fields, i do : 

$exemple = $form_state['field']['field_one']['und']['entity'][2]-&gt;sub_field['und'][0]['value'];


(my form content contains a collection field).
It's very ugly...
If you've got a complete entity in that form, or some type of structure that the Entity API knows about, because it's been defined in hook_entity_info and/or hook_property_info, you can wrap virtually anything, for example:

$data = array('pears', 'apples', 'oranges');
$wrapper = entity_metadata_wrapper('struct', $data);
dpm($wrapper-&gt;value());


But you won't have all the goodies of the wrappers, which are the smart metadata information about the values you're retrieving, you can find how to build your own in the entity module, for example in entity_metadata_site_wrapper:

function entity_metadata_site_wrapper() {
  $site_info = entity_get_property_info('site');
  $info['property info'] = $site_info['properties'];
  return entity_metadata_wrapper('site', FALSE, $info);
}


site is not an entity or field structure at all, but it has been defined by a hook_entity_property_info, in entity_metadata_system_entity_property_info so you can wrap it normally and Entity API will go and fetch the properties you define by using the callbacks you've defined:

function entity_metadata_system_entity_property_info() {
  $info = array();

  // There is no site entity, but still add metadata for global site properties
  // here. That way modules can alter and add further properties at this place.
  // In order to make use of this metadata modules may use the wrapper returned
  // by entity_metadata_site_wrapper().
  $properties = &amp;$info['site']['properties'];
  $properties['name'] = array(
    'label' =&gt; t("Name"),
    'description' =&gt; t("The name of the site."),
    'getter callback' =&gt; 'entity_metadata_system_get_properties',
    'sanitize' =&gt; 'check_plain',
  );
  $properties['slogan'] = array(
    'label' =&gt; t("Slogan"),
    'description' =&gt; t("The slogan of the site."),
    'getter callback' =&gt; 'entity_metadata_system_get_properties',
    'sanitize' =&gt; 'check_plain',
  );
(...)


So if you've got an entity (saved or not, this only will limit how the data is accessed), you can wrap it normally and access to it, and if you have another type of structure, Entity Metadata Wrappers will still know how to deal with this if you or another module defines so.