function field_form_get_state

Retrieves processing information about a field from $form_state.


$parents: The array of #parents where the field lives in the form.

$field_name: The field name.

$langcode: The language in which the field values are entered.

$form_state: The form state.

Return value

An array with the following key/data pairs:

  • field: the field definition array,
  • instance: the field instance definition array,
  • items_count: the number of widgets to display for the field,
  • array_parents: the location of the field's widgets within the $form structure. This entry is populated at '#after_build' time.
  • errors: the array of field validation errors reported on the field. This entry is populated at field_attach_form_validate() time.

See also


12 calls to field_form_get_state()
field_add_more_js in drupal/modules/field/
Ajax callback in response to a new empty widget being added to the form.
field_add_more_submit in drupal/modules/field/
Submit handler for the "Add another item" button of a field form.
field_attach_form_validate in drupal/modules/field/
Perform field validation against form-submitted field values.
field_default_form in drupal/modules/field/
Creates a form element for a field and can populate it with a default value.
field_default_form_errors in drupal/modules/field/
Transfer field-level validation errors to widgets.

... See full list


drupal/modules/field/, line 505
Field forms management.


function field_form_get_state($parents, $field_name, $langcode, &$form_state) {
  $form_state_parents = _field_form_state_parents($parents, $field_name, $langcode);
  return drupal_array_get_nested_value($form_state, $form_state_parents);