You are here

public function NoscriptTagSettingsForm::submitForm in Noscript Tag 8

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/NoscriptTagSettingsForm.php, line 58

Class

NoscriptTagSettingsForm
Class NoscriptTagSettingsForm.

Namespace

Drupal\noscript_tag\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {

  // Submitted Message.
  $submitted_message = $form_state
    ->getValue('noscript_tag_value');

  // Extract the value.
  $noscript_tag_value = $submitted_message['value'];
  $noscript_tag_format = $submitted_message['format'];

  // Save to config.
  $this
    ->config('noscript_tag.settings')
    ->set('noscript_tag_value', $noscript_tag_value)
    ->set('noscript_tag_format', $noscript_tag_format)
    ->save();

  // Call the parent Submit function.
  parent::submitForm($form, $form_state);
}