function field_form_element_after_build

#after_build callback for field elements in a form.

This stores the final location of the field within the form structure so that field_default_form_errors() can assign validation errors to the right form element.

See also


1 string reference to 'field_form_element_after_build'
field_default_form in drupal/modules/field/
Creates a form element for a field and can populate it with a default value.


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


function field_form_element_after_build($element, &$form_state) {
  $parents = $element['#field_parents'];
  $field_name = $element['#field_name'];
  $langcode = $element['#language'];
  $field_state = field_form_get_state($parents, $field_name, $langcode, $form_state);
  $field_state['array_parents'] = $element['#array_parents'];
  field_form_set_state($parents, $field_name, $langcode, $form_state, $field_state);
  return $element;