You are here

public function EditForm::submitForm in Linkit 8.4

Same name in this branch
  1. 8.4 src/Form/Attribute/EditForm.php \Drupal\linkit\Form\Attribute\EditForm::submitForm()
  2. 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/Attribute/EditForm.php, line 79
Contains \Drupal\linkit\Form\Attribute\EditForm.

Class

EditForm
Provides an edit form for attributes.

Namespace

Drupal\linkit\Form\Attribute

Code

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