You are here

public function XmlSitemapCustomEditForm::submitForm in XML sitemap 2.x

Same name and namespace in other branches
  1. 8 xmlsitemap_custom/src/Form/XmlSitemapCustomEditForm.php \Drupal\xmlsitemap_custom\Form\XmlSitemapCustomEditForm::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/XmlSitemapCustomEditForm.php, line 200

Class

XmlSitemapCustomEditForm
Provides a form for editing 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');
}