field_default_extract_form_values
function field_default_extract_form_values
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
- 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; } }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/modules!field!field.default.inc/function/field_default_extract_form_values/7.x