You are here

protected function FieldValidationRuleSetEditForm::updateFieldValidationRuleWeights in Field Validation 8

Updates fieldValidationRule weights.

Parameters

array $field_validation_rules: Associative array with tabs having fieldValidationRule uuid as keys and array with fieldValidationRule data as values.

1 call to FieldValidationRuleSetEditForm::updateFieldValidationRuleWeights()
FieldValidationRuleSetEditForm::submitForm in src/Form/FieldValidationRuleSetEditForm.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/Form/FieldValidationRuleSetEditForm.php, line 290

Class

FieldValidationRuleSetEditForm
Controller for blocktabs edit form.

Namespace

Drupal\field_validation\Form

Code

protected function updateFieldValidationRuleWeights(array $field_validation_rules) {
  foreach ($field_validation_rules as $uuid => $field_validation_rule_data) {
    if ($this->entity
      ->getFieldValidationRules()
      ->has($uuid)) {
      $this->entity
        ->getFieldValidationRule($uuid)
        ->setWeight($field_validation_rule_data['weight']);
    }
  }
}