You are here

public function PanopolyThemeSelectionForm::submitForm in Panopoly 8.2

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

modules/panopoly/panopoly_theme/src/Form/PanopolyThemeSelectionForm.php, line 149

Class

PanopolyThemeSelectionForm
Provides a form to choose the starting theme.

Namespace

Drupal\panopoly_theme\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {

  // Set the default theme.
  if ($theme = $form_state
    ->getValue('theme')) {
    $this->themeInstaller
      ->install([
      $theme,
    ]);
    $this->configFactory
      ->getEditable('system.theme')
      ->set('default', $theme)
      ->save();
  }
}