function field_default_extract_form_values

Extracts field values from submitted form values.

Parameters

$entity_type: The type of $entity.

$entity: The entity for the operation.

$field: The field structure for the operation.

$instance: The instance structure for $field on $entity's bundle.

$langcode: The language associated to $items.

$items: The field values. This parameter is altered by reference to receive the incoming form values.

$form: The form structure where field elements are attached to. This might be a full form structure, or a sub-element of a larger form.

$form_state: The form state.

2 calls to field_default_extract_form_values()
field_ui_field_edit_form_submit in drupal/modules/field_ui/field_ui.admin.inc
Form submission handler for field_ui_field_edit_form().
field_ui_field_edit_form_validate in drupal/modules/field_ui/field_ui.admin.inc
Form validation handler for field_ui_field_edit_form().
2 invocations of field_default_extract_form_values()
field_attach_form_validate in drupal/modules/field/field.attach.inc
Perform field validation against form-submitted field values.
field_attach_submit in drupal/modules/field/field.attach.inc
Perform necessary operations on field data submitted by a form.

File

drupal/modules/field/field.default.inc, line 35
Default 'implementations' of hook_field_*(): common field housekeeping.

Code

function field_default_extract_form_values($entity_type, $entity, $field, $instance, $langcode, &$items, $form, &$form_state) {
  $path = array_merge($form['#parents'], array(
    $field['field_name'],
    $langcode,
  ));
  $key_exists = NULL;
  $values = drupal_array_get_nested_value($form_state['values'], $path, $key_exists);
  if ($key_exists) {

    // Remove the 'value' of the 'add more' button.
    unset($values['add_more']);
    $items = $values;
  }
}