You are here

public function ModuleConfigureForm::submitForm in Open Social 8.8

Same name and namespace in other branches
  1. 8.9 src/Installer/Form/ModuleConfigureForm.php \Drupal\social\Installer\Form\ModuleConfigureForm::submitForm()
  2. 10.3.x src/Installer/Form/ModuleConfigureForm.php \Drupal\social\Installer\Form\ModuleConfigureForm::submitForm()
  3. 10.0.x src/Installer/Form/ModuleConfigureForm.php \Drupal\social\Installer\Form\ModuleConfigureForm::submitForm()
  4. 10.1.x src/Installer/Form/ModuleConfigureForm.php \Drupal\social\Installer\Form\ModuleConfigureForm::submitForm()
  5. 10.2.x src/Installer/Form/ModuleConfigureForm.php \Drupal\social\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 ConfigFormBase::submitForm

File

src/Installer/Form/ModuleConfigureForm.php, line 134

Class

ModuleConfigureForm
Provides the site configuration form.

Namespace

Drupal\social\Installer\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  if ($form_state
    ->getValue('select_all')) {

    // Create a simple array with all the possible optional modules.
    $optional_modules = array_keys($this->optionalModuleManager
      ->getOptionalModules());
  }
  else {

    // Filter out the unselected modules.
    $selected_modules = array_filter($form_state
      ->getValue('optional_modules'));

    // Create a simple array of just the module names as values.
    $optional_modules = array_values($selected_modules);
  }

  // Set the modules to be installed by Drupal in the install_profile_modules
  // step.
  $install_modules = array_merge(\Drupal::state()
    ->get('install_profile_modules'), $optional_modules);
  \Drupal::state()
    ->set('install_profile_modules', $install_modules);

  // Store whether we need to set up demo content.
  \Drupal::state()
    ->set('social_install_demo_content', $form_state
    ->getValue('demo_content'));
}