public FormSubmitter::executeSubmitHandlers(&$form, FormStateInterface &$form_state)
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
File
- core/lib/Drupal/Core/Form/FormSubmitter.php, line 90
Class
- FormSubmitter
- Provides submission processing for forms.
Namespace
Drupal\Core\Form
Code
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)); } } }
Please login to continue.