1 field.default.inc field_default_extract_form_values($entity_type, $entity, $field, $instance, $langcode, &$items, $form, &$form_state)

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.

File

core/modules/field/field.default.inc, line 34
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 = backdrop_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;
  }
}