function field_form_get_state

Retrieves processing information about a field from $form_state.

Parameters

$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

field_form_set_state()

13 calls to field_form_get_state()
FieldInstanceEditForm::validateForm in drupal/core/modules/field_ui/lib/Drupal/field_ui/Form/FieldInstanceEditForm.php
Form validation handler.
field_add_more_js in drupal/core/modules/field/field.form.inc
Ajax callback: Responds to a new empty widget being added to the form.
field_add_more_submit in drupal/core/modules/field/field.form.inc
Form submission handler for the "Add another item" button of a field form.
field_attach_form_validate in drupal/core/modules/field/field.attach.inc
Performs field validation against form-submitted field values.
field_form_element_after_build in drupal/core/modules/field/field.form.inc
After-build callback for field elements in a form.

... See full list

File

drupal/core/modules/field/field.form.inc, line 198
Field forms management.

Code

function field_form_get_state($parents, $field_name, $langcode, &$form_state) {
  $form_state_parents = _field_form_state_parents($parents, $field_name, $langcode);
  return NestedArray::getValue($form_state, $form_state_parents);
}