function DraggableListBuilderTrait::submitForm
Same name in other branches
- 10 core/lib/Drupal/Core/Entity/DraggableListBuilderTrait.php \Drupal\Core\Entity\DraggableListBuilderTrait::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.
Throws
\Drupal\Core\Entity\EntityStorageException If there is a failure when saving the entity.
See also
\Drupal\Core\Form\FormInterface::submitForm()
5 calls to DraggableListBuilderTrait::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 DraggableListBuilderTrait::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/ Entity/ DraggableListBuilderTrait.php, line 210
Class
- DraggableListBuilderTrait
- Provides a trait for draggable listings of entities.
Namespace
Drupal\Core\EntityCode
public function submitForm(array &$form, FormStateInterface $form_state) {
foreach ($form_state->getValue($this->entitiesKey) as $id => $value) {
if (isset($this->entities[$id]) && $this->getWeight($this->entities[$id]) != $value['weight']) {
// Save entity only when its weight was changed.
$this->setWeight($this->entities[$id], $value['weight']);
$this->entities[$id]
->save();
}
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.