function subform_execute_submit_handlers in Subform 7
A helper function used to execute submission handlers for a given subform.
Contains code that is duplicated here.
See also
1 call to subform_execute_submit_handlers()
- subform_submit_subform in ./
subform.module - Submits a subform.
File
- ./
subform.module, line 953 - Defines a subform element type.
Code
function subform_execute_submit_handlers(&$form, &$form_state) {
// If there was a button pressed, use its handlers.
if (isset($form_state['submit_handlers'])) {
$handlers = $form_state['submit_handlers'];
}
elseif (isset($form['#submit'])) {
$handlers = $form['#submit'];
}
else {
$handlers = array();
}
foreach ($handlers as $function) {
// Check if a previous _submit handler has set a batch, but make sure we
// do not react to a batch that is already being processed (for instance
// if a batch operation performs a drupal_form_submit()).
if (($batch =& batch_get()) && !isset($batch['id'])) {
// Some previous submit handler has set a batch. To ensure correct
// execution order, store the call in a special 'control' batch set.
// We don't have to set $batch['has_form_submits'] as
// subform_parent_after_submit() is always registered for forms containing
// subforms. So form_execute_handlers() will set $batch['has_form_submits']
// for the root form.
batch_set(array(
'operations' => array(
array(
'subform_batch_execute_subform_submit_handler',
array(
$form_state['subform_name'],
$function,
),
),
),
));
}
else {
$function($form, $form_state);
}
}
}