You are here

public function SettingsForm::submitForm in Bootstrap Styles 1.0.x

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/Form/SettingsForm.php, line 119

Class

SettingsForm
Configure Bootstrap Styles settings.

Namespace

Drupal\bootstrap_styles\Form

Code

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

  // Save layout builder theme.
  $this
    ->config(static::SETTINGS)
    ->set('layout_builder_theme', $form_state
    ->getValue('layout_builder_theme'))
    ->save();
  foreach ($this->stylesGroupManager
    ->getStylesGroups() as $group_plugin_id => $style_group) {

    // Submit group form.
    $group_instance = $this->stylesGroupManager
      ->createInstance($group_plugin_id);
    $group_instance
      ->submitConfigurationForm($form, $form_state);
    if (isset($style_group['styles'])) {
      foreach ($style_group['styles'] as $style_plugin_id => $style) {

        // Submit style form.
        $style_instance = $this->styleManager
          ->createInstance($style_plugin_id);
        $style_instance
          ->submitConfigurationForm($form, $form_state);
      }
    }
  }
}