You are here

public function RobotsTxtAdminSettingsForm::submitForm in RobotsTxt 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/RobotsTxtAdminSettingsForm.php, line 48

Class

RobotsTxtAdminSettingsForm
Configure robotstxt settings for this site.

Namespace

Drupal\robotstxt\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $config = $this
    ->config('robotstxt.settings');
  $config
    ->set('content', $form_state
    ->getValue('robotstxt_content'))
    ->save();
  Cache::invalidateTags([
    'robotstxt',
  ]);
  parent::submitForm($form, $form_state);
}