You are here

public function LoginDestinationListBuilder::submitForm in Login Destination 8

Same name and namespace in other branches
  1. 8.2 src/Controller/LoginDestinationListBuilder.php \Drupal\login_destination\Controller\LoginDestinationListBuilder::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 DraggableListBuilder::submitForm

File

src/Controller/LoginDestinationListBuilder.php, line 87

Class

LoginDestinationListBuilder
Provides a listing of Login Destinations rules.

Namespace

Drupal\login_destination\Controller

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  parent::submitForm($form, $form_state);
  foreach ($form_state
    ->getValue($this->entitiesKey) as $id => $value) {

    // Save entity only when its weight was changed.
    $this->entities[$id]
      ->set('enabled', $value['enabled']);
    $this->entities[$id]
      ->save();
  }
}