You are here

public function EditForm::submitForm in Linkit 8.5

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

Class

EditForm
Provides an edit form for matchers.

Namespace

Drupal\linkit\Form\Matcher

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  $form_state
    ->cleanValues();
  $plugin_data = (new FormState())
    ->setValues($form_state
    ->getValues());
  $this->linkitMatcher
    ->submitConfigurationForm($form, $plugin_data);
  $this->linkitProfile
    ->save();
  $this
    ->messenger()
    ->addMessage($this
    ->t('Saved %label configuration.', [
    '%label' => $this->linkitMatcher
      ->getLabel(),
  ]));
  $this
    ->logger('linkit')
    ->notice('The matcher %label has been updated in the @profile profile.', [
    '%label' => $this->linkitMatcher
      ->getLabel(),
    '@profile' => $this->linkitProfile
      ->label(),
  ]);
  $form_state
    ->setRedirect('linkit.matchers', [
    'linkit_profile' => $this->linkitProfile
      ->id(),
  ]);
}