You are here

public function DeleteForm::submitForm in Linkit 8.5

Same name and namespace in other branches
  1. 8.4 src/Form/Matcher/DeleteForm.php \Drupal\linkit\Form\Matcher\DeleteForm::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

src/Form/Matcher/DeleteForm.php, line 70

Class

DeleteForm
Provides a form to remove a matcher from a profile.

Namespace

Drupal\linkit\Form\Matcher

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $this->linkitProfile
    ->removeMatcher($this->linkitMatcher);
  $this
    ->messenger()
    ->addMessage($this
    ->t('The matcher %label has been deleted.', [
    '%label' => $this->linkitMatcher
      ->getLabel(),
  ]));
  $this
    ->logger('linkit')
    ->notice('The matcher %label has been deleted in the @profile profile.', [
    '%label' => $this->linkitMatcher
      ->getLabel(),
    '@profile' => $this->linkitProfile
      ->label(),
  ]);
  $form_state
    ->setRedirect('linkit.matchers', [
    'linkit_profile' => $this->linkitProfile
      ->id(),
  ]);
}