You are here

public function OverviewForm::submitForm in Linkit 8.4

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

Class

OverviewForm
Provides an overview form for attribute on a profile.

Namespace

Drupal\linkit\Form\Attribute

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  foreach ($form_state
    ->getValue('plugins') as $id => $plugin_data) {
    if ($this->linkitProfile
      ->getAttributes()
      ->has($id)) {
      $this->linkitProfile
        ->getAttribute($id)
        ->setWeight($plugin_data['weight']);
    }
  }
  $this->linkitProfile
    ->save();
}