You are here

public function DraggableListBuilder::submitForm in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Core/Config/Entity/DraggableListBuilder.php \Drupal\Core\Config\Entity\DraggableListBuilder::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

5 calls to DraggableListBuilder::submitForm()
FilterFormatListBuilder::submitForm in core/modules/filter/src/FilterFormatListBuilder.php
Form submission handler.
LanguageListBuilder::submitForm in core/modules/language/src/LanguageListBuilder.php
Form submission handler.
RoleListBuilder::submitForm in core/modules/user/src/RoleListBuilder.php
Form submission handler.
SearchPageListBuilder::submitForm in core/modules/search/src/SearchPageListBuilder.php
Form submission handler.
VocabularyListBuilder::submitForm in core/modules/taxonomy/src/VocabularyListBuilder.php
Form submission handler.
5 methods override DraggableListBuilder::submitForm()
FilterFormatListBuilder::submitForm in core/modules/filter/src/FilterFormatListBuilder.php
Form submission handler.
LanguageListBuilder::submitForm in core/modules/language/src/LanguageListBuilder.php
Form submission handler.
RoleListBuilder::submitForm in core/modules/user/src/RoleListBuilder.php
Form submission handler.
SearchPageListBuilder::submitForm in core/modules/search/src/SearchPageListBuilder.php
Form submission handler.
VocabularyListBuilder::submitForm in core/modules/taxonomy/src/VocabularyListBuilder.php
Form submission handler.

File

core/lib/Drupal/Core/Config/Entity/DraggableListBuilder.php, line 160
Contains \Drupal\Core\Config\Entity\DraggableListBuilder.

Class

DraggableListBuilder
Defines a class to build a draggable listing of configuration entities.

Namespace

Drupal\Core\Config\Entity

Code

public function submitForm(array &$form, FormStateInterface $form_state) {
  foreach ($form_state
    ->getValue($this->entitiesKey) as $id => $value) {
    if (isset($this->entities[$id]) && $this->entities[$id]
      ->get($this->weightKey) != $value['weight']) {

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