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

field_default_form_errors()

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

File

modules/field/field.form.inc, line 385

Code

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;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.