You are here

public function StylesFilterConfigForm::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/StylesFilterConfigForm.php, line 94

Class

StylesFilterConfigForm
Configure and filter styles' plugins.

Namespace

Drupal\bootstrap_styles\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $config = $this->configFactory
    ->getEditable(static::CONFIG);
  if ($form_state
    ->getValue('styles_groups')) {
    $styles_group = $form_state
      ->getValue('styles_groups');
    foreach ($styles_group as $group_key => $styles) {
      foreach ($styles as $style_key => $style) {
        foreach ($style as $key => $value) {
          $config_option_name = 'plugins.' . $group_key . '.' . $style_key . '.' . $key;
          $config
            ->set($config_option_name, $value);
        }
      }
    }
    $config
      ->save();
  }
  parent::submitForm($form, $form_state);
}