public function PriceListListBuilder::submitForm in Commerce Pricelist 8.2
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/
PriceListListBuilder.php, line 200
Class
- PriceListListBuilder
- Defines the list builder for price lists.
Namespace
Drupal\commerce_pricelistCode
public function submitForm(array &$form, FormStateInterface $form_state) {
foreach ($form_state
->getValue('price_lists') as $id => $value) {
if (isset($this->entities[$id]) && $this->entities[$id]
->getWeight() != $value['weight']) {
// Save entity only when its weight was changed.
$this->entities[$id]
->setWeight($value['weight']);
$this->entities[$id]
->save();
}
}
}