You are here

public function XmlSitemapCustomDeleteForm::submitForm in XML sitemap 8

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

Class

XmlSitemapCustomDeleteForm
Provides a form for deleting a custom link.

Namespace

Drupal\xmlsitemap_custom\Form

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $this->linkStorage
    ->delete('custom', $this->custom_link['id']);
  $this
    ->logger('xmlsitemap')
    ->debug('The custom link for %loc has been deleted.', [
    '%loc' => $this->custom_link['loc'],
  ]);
  $this
    ->messenger()
    ->addStatus($this
    ->t('The custom link for %loc has been deleted.', [
    '%loc' => $this->custom_link['loc'],
  ]));
  $form_state
    ->setRedirectUrl($this
    ->getCancelUrl());
}