You are here

public function FlagListsSettingForm::submitForm in Flag Lists 4.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/FlagListsSettingForm.php, line 93

Class

FlagListsSettingForm
Class FlaggingCollectionSettingsForm.

Namespace

Drupal\flag_lists\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $this
    ->config('flag_lists.settings')
    ->set('hide_collections', $form_state
    ->getValue('hide_collections'))
    ->save();
  $this
    ->config('flag_lists.settings')
    ->set('hide_collections_in_displays', $form_state
    ->getValue('hide_collections_in_displays'))
    ->save();
  $this
    ->config('flag_lists.settings')
    ->set('hide_templates_in_displays', $form_state
    ->getValue('hide_templates_in_displays'))
    ->save();
  $clearCacheLink = Link::createFromRoute('cache', 'system.performance_settings')
    ->toString();
  $this
    ->messenger()
    ->addStatus($this
    ->t('If needed, please clear the @link!', [
    '@link' => $clearCacheLink,
  ]));

  // Only invalidating using the generic cache tag.
  $this->cacheTagsInvalidator
    ->invalidateTags([
    'config:entity_view_display_list',
  ]);
}