public function FormSubmitter::executeSubmitHandlers in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/lib/Drupal/Core/Form/FormSubmitter.php \Drupal\Core\Form\FormSubmitter::executeSubmitHandlers()
Executes custom submission handlers for a given form.
Button-specific handlers are checked first. If none exist, the function falls back to form-level handlers.
Parameters
$form: An associative array containing the structure of the form.
$form_state: The current state of the form. If the user submitted the form by clicking a button with custom handler functions defined, those handlers will be stored here.
Overrides FormSubmitterInterface::executeSubmitHandlers
1 call to FormSubmitter::executeSubmitHandlers()
- FormSubmitter::doSubmitForm in core/
lib/ Drupal/ Core/ Form/ FormSubmitter.php - Handles the submitted form, executing callbacks and processing responses.
File
- core/
lib/ Drupal/ Core/ Form/ FormSubmitter.php, line 95 - Contains \Drupal\Core\Form\FormSubmitter.
Class
- FormSubmitter
- Provides submission processing for forms.
Namespace
Drupal\Core\FormCode
public function executeSubmitHandlers(&$form, FormStateInterface &$form_state) {
// If there was a button pressed, use its handlers.
$handlers = $form_state
->getSubmitHandlers();
// Otherwise, check for a form-level handler.
if (!$handlers && !empty($form['#submit'])) {
$handlers = $form['#submit'];
}
foreach ($handlers as $callback) {
// 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\Core\Form\FormBuilderInterface::submitForm()).
if (($batch =& $this
->batchGet()) && !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.
// See _batch_next_set().
$batch['sets'][] = array(
'form_submit' => $callback,
);
$batch['has_form_submits'] = TRUE;
}
else {
call_user_func_array($form_state
->prepareCallback($callback), array(
&$form,
&$form_state,
));
}
}
}