You are here

public function jQueryUiFilterSettingsForm::submitForm in jQuery UI filter 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 ConfigFormBase::submitForm

File

src/Form/jQueryUiFilterSettingsForm.php, line 105
Contains \Drupal\jquery_ui_filter\Form\jQueryUiFilterSettingsForm.

Class

jQueryUiFilterSettingsForm
Defines a form that configures jQuery UI filter settings.

Namespace

Drupal\jquery_ui_filter\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $config = $this
    ->config('jquery_ui_filter.settings');
  $data = $form_state
    ->getValue('jquery_ui_filter');
  foreach (jQueryUiFilter::$widgets as $name => $widget) {
    $data[$name]['options'] = (Yaml::decode($data[$name]['options']) ?: []) + $widget['options'];
  }
  $config
    ->setData($data);
  $config
    ->save();
  parent::submitForm($form, $form_state);
}