You are here

public function PrintableConfigurationForm::submitForm in Printer and PDF versions for Drupal 8+ 8

Same name and namespace in other branches
  1. 2.x src/Form/PrintableConfigurationForm.php \Drupal\printable\Form\PrintableConfigurationForm::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/PrintableConfigurationForm.php, line 135

Class

PrintableConfigurationForm
Provides shared configuration form for all printable formats.

Namespace

Drupal\printable\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $this->configFactory
    ->getEditable('printable.settings')
    ->set('printable_entities', $form_state
    ->getValue('printable_entities'))
    ->set('open_target_blank', $form_state
    ->getValue('open_target_blank'))
    ->set('css_include', $form_state
    ->getValue('css_include'))
    ->set('extract_links', $form_state
    ->getValue('extract_links'))
    ->save();

  // Invalidate the block cache to update custom block-based derivatives.
  // @todo try to make configsaveevent later.
  $this->blockManager
    ->clearCachedDefinitions();
  parent::submitForm($form, $form_state);
}