You are here

public function ModuleConfigureForm::submitForm in Thunder 6.1.x

Same name and namespace in other branches
  1. 8.5 src/Installer/Form/ModuleConfigureForm.php \Drupal\thunder\Installer\Form\ModuleConfigureForm::submitForm()
  2. 8.2 src/Installer/Form/ModuleConfigureForm.php \Drupal\thunder\Installer\Form\ModuleConfigureForm::submitForm()
  3. 8.3 src/Installer/Form/ModuleConfigureForm.php \Drupal\thunder\Installer\Form\ModuleConfigureForm::submitForm()
  4. 8.4 src/Installer/Form/ModuleConfigureForm.php \Drupal\thunder\Installer\Form\ModuleConfigureForm::submitForm()
  5. 6.2.x src/Installer/Form/ModuleConfigureForm.php \Drupal\thunder\Installer\Form\ModuleConfigureForm::submitForm()
  6. 6.0.x src/Installer/Form/ModuleConfigureForm.php \Drupal\thunder\Installer\Form\ModuleConfigureForm::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/Installer/Form/ModuleConfigureForm.php, line 287

Class

ModuleConfigureForm
Provides the site configuration form.

Namespace

Drupal\thunder\Installer\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $operations = [];
  foreach ($form_state
    ->getValue('install_modules') as $module => $values) {
    $extension = $this->moduleExtensionList
      ->get($module);
    if (!$extension->status && $values['enable']) {
      $operations[] = [
        [
          $this,
          'batchOperation',
        ],
        [
          $module,
        ],
      ];
    }
  }
  if ($operations) {
    $batch = [
      'operations' => $operations,
      'title' => $this
        ->t('Installing additional modules'),
      'error_message' => $this
        ->t('The installation has encountered an error.'),
    ];
    if (InstallerKernel::installationAttempted()) {
      $buildInfo = $form_state
        ->getBuildInfo();
      $buildInfo['args'][0]['thunder_install_batch'] = $batch;
      $form_state
        ->setBuildInfo($buildInfo);
    }
    else {
      batch_set($batch);
    }
  }
}