function subform_parent_after_validate in Subform 7
Validation handler to be run after all other validation handlers.
Registers this callback.
See also
File
- ./
subform.module, line 488 - Defines a subform element type.
Code
function subform_parent_after_validate(&$form, &$form_state) {
if (!empty($form_state['temporary']['subform'])) {
// If we're not going to submit the parent form we need to cache its subforms here,
// except when the form is going to be rebuild as subform_element_process()
// will cache it during the rebuild.
$submit = $form_state['submitted'] && !form_get_errors() && !$form_state['rebuild'];
foreach ($form_state['temporary']['subform'] as $subform_name => &$subform_state) {
// Cache subform if neccesary. Caching the subforms here allows for making
// changes to subform states in any validation handler.
if (!$submit && !$form_state['rebuild'] && empty($form_state['programmed']) && !$subform_state['rebuild'] && $subform_state['cache'] && empty($subform_state['no_cache'])) {
form_set_cache($subform_state['values']['form_build_id'], $subform_state['temporary']['subform_unprocessed'], $subform_state);
}
}
}
}