You are here

public function BulkUpdateFieldsForm::submitForm in Bulk Update Fields 8

Same name and namespace in other branches
  1. 8.2 src/Form/BulkUpdateFieldsForm.php \Drupal\bulk_update_fields\Form\BulkUpdateFieldsForm::submitForm()

Form submission handler.

Parameters

array $form: An associative array containing the structure of the form.

\Drupal\Core\Form\FormStateInterface $form_state: The current state of the form.

Overrides FormInterface::submitForm

File

src/Form/BulkUpdateFieldsForm.php, line 122

Class

BulkUpdateFieldsForm
BulkUpdateFieldsForm.

Namespace

Drupal\bulk_update_fields\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  switch ($this->step) {
    case 1:
      $this->userInput['fields'] = array_filter($form_state
        ->getValues()['table']);
      $form_state
        ->setRebuild();
      break;
    case 2:
      $this->userInput['fields'] = array_merge($this->userInput['fields'], $form_state
        ->getValues()['default_value_input']);
      $form_state
        ->setRebuild();
      break;
    case 3:
      if (method_exists($this, 'updateFields')) {
        $return_verify = $this
          ->updateFields();
      }
      drupal_set_message($return_verify);
      $this->routeBuilder
        ->rebuild();
      break;
  }
  $this->step++;
}