You are here

public function XmlSitemapCustomAddForm::submitForm in XML sitemap 8

Same name and namespace in other branches
  1. 2.x xmlsitemap_custom/src/Form/XmlSitemapCustomAddForm.php \Drupal\xmlsitemap_custom\Form\XmlSitemapCustomAddForm::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 FormInterface::submitForm

File

xmlsitemap_custom/src/Form/XmlSitemapCustomAddForm.php, line 240

Class

XmlSitemapCustomAddForm
Provides a form for adding a custom link.

Namespace

Drupal\xmlsitemap_custom\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $form_state
    ->cleanValues();
  $link = $form_state
    ->getValues();
  $this->linkStorage
    ->save($link);
  $this
    ->messenger()
    ->addStatus($this
    ->t('The custom link for %loc was saved.', [
    '%loc' => $link['loc'],
  ]));
  $form_state
    ->setRedirect('xmlsitemap_custom.list');
}