You are here

public function StylesOverviewForm::submitForm in Paragraphs Collection 8

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/StylesOverviewForm.php, line 193

Class

StylesOverviewForm
Provides a form for revision overview page.

Namespace

Drupal\paragraphs_collection\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  parent::submitForm($form, $form_state);
  $enabled_styles = array_keys(array_filter((array) $form_state
    ->getValue('styles'), function ($value) {
    return !empty($value['enabled']);
  }));
  $this->config
    ->set('enabled_styles', $enabled_styles);
  $this->config
    ->save();
}