function DraggableListBuilder::submitForm

Same name in other branches
  1. 9 core/lib/Drupal/Core/Config/Entity/DraggableListBuilder.php \Drupal\Core\Config\Entity\DraggableListBuilder::submitForm()

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

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();
        }
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.