How to load the entity form field values in custom module

Warning message

JQuery Cycle must be installed in order to run the slideshow. Please go to Status Report for instructions.

Primary tabs

Suppose you are using drupal entity form rather than a webform, because you would like to group the fields and take advantage of add more button. Using entity form is also useful when you have to interact with drupal core node fields. Below code is useful if you want to get the values of fields inside a particular entity form.

  $entityform_id = 1; // entity form id
  $entityform = entityform_load($entityform_id);
  $entityform_wrapper = entity_metadata_wrapper('entityform', $entityform);
  // Access fields with $entityform_wrapper->field_name->value() or ->field_name->raw()
  $field_my_field = $entityform_wrapper->field_name->value(); // for example

  // If you have single field 
  drupal_set_message($entityform_wrapper->field_my_field->value()); // for example

  // if you have mutilple fields using field collection and field_my_field is a group of fields from field collection
  foreach ($field_my_field as $field_my_field_key => $field_my_field_value) {