You are here

public function HumansTxtAdminSettingsForm::submitForm in Humans.txt 8

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

Class

HumansTxtAdminSettingsForm
Class HumanstxtAdminSettingsForm implements the Humanstxt Settings Form.

Namespace

Drupal\humanstxt\Form

Code

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

  // Get the values from the form state.
  $content_submit = $form_state
    ->getValue('humanstxt_content');
  $display_link_submit = $form_state
    ->getValue('humanstxt_display_link');

  // Set the new values in the config object of the module.
  $this
    ->config('humanstxt.settings')
    ->set('content', $content_submit)
    ->set('display_link', $display_link_submit)
    ->save();

  // Delete former cache tags.
  Cache::invalidateTags([
    'humanstxt',
  ]);
  parent::submitForm($form, $form_state);
}