protected function WebformEntityVariantsForm::updateVariantWeights in Webform 6.x
Same name and namespace in other branches
- 8.5 src/WebformEntityVariantsForm.php \Drupal\webform\WebformEntityVariantsForm::updateVariantWeights()
Updates webform variant weights.
Parameters
array $variants: Associative array with variants having variant ids as keys and array with variant data as values.
1 call to WebformEntityVariantsForm::updateVariantWeights()
- WebformEntityVariantsForm::submitForm in src/
WebformEntityVariantsForm.php - This is the default entity object builder function. It is called before any other submit handler to build the new entity object to be used by the following submit handlers. At this point of the form workflow the entity is validated and the form state…
File
- src/
WebformEntityVariantsForm.php, line 392
Class
- WebformEntityVariantsForm
- Provides a webform to manage submission variants.
Namespace
Drupal\webformCode
protected function updateVariantWeights(array $variants) {
foreach ($variants as $variant_id => $variant_data) {
if ($this->entity
->getVariants()
->has($variant_id)) {
$this->entity
->getVariant($variant_id)
->setWeight($variant_data['weight']);
}
}
}