You are here

public function SettingsForm::submitForm in Display Suite 8.2

Same name and namespace in other branches
  1. 8.4 src/Form/SettingsForm.php \Drupal\ds\Form\SettingsForm::submitForm()
  2. 8.3 src/Form/SettingsForm.php \Drupal\ds\Form\SettingsForm::submitForm()

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 179

Class

SettingsForm
Configures Display Suite settings for this site.

Namespace

Drupal\ds\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  parent::submitForm($form, $form_state);
  $values = $form_state
    ->getValues();
  $this
    ->config('ds.settings')
    ->set('field_template', $values['fs1']['field_template'])
    ->set('ft-default', $values['fs1']['ft-default'])
    ->set('ft-show-colon', $values['fs1']['ft-show-colon'])
    ->set('use_field_names', $values['fs3']['use_field_names'])
    ->save();
  $this->entityFieldManager
    ->clearCachedFieldDefinitions();
  $this->moduleHandler
    ->resetImplementations();
  $this->themeRegistry
    ->reset();
  $this->routeBuilder
    ->setRebuildNeeded();
  \Drupal::cache('render')
    ->deleteAll();
  if ($this->moduleHandler
    ->moduleExists('dynamic_page_cache')) {
    \Drupal::cache('dynamic_page_cache')
      ->deleteAll();
  }
}