You are here

public function SettingsForm::submitForm in Lightning Media 8.4

Same name and namespace in other branches
  1. 8 src/Form/SettingsForm.php \Drupal\lightning_media\Form\SettingsForm::submitForm()
  2. 8.2 src/Form/SettingsForm.php \Drupal\lightning_media\Form\SettingsForm::submitForm()
  3. 8.3 src/Form/SettingsForm.php \Drupal\lightning_media\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 66

Class

SettingsForm
The settings form for controlling Lightning Media's behavior.

Namespace

Drupal\lightning_media\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $this
    ->config('lightning_media.settings')
    ->set('entity_embed.choose_display', (bool) $form_state
    ->getValue('choose_display'))
    ->set('revision_ui', (bool) $form_state
    ->getValue('revision_ui'))
    ->save();

  // Clear the cached entity type definitions so that the new visibility of
  // the revision UI will take effect.
  // @see lightning_media_entity_type_alter()
  $this->entityTypeManager
    ->clearCachedDefinitions();
  parent::submitForm($form, $form_state);
}