You are here

public function FieldValidationRulePluginCollection::sortHelper in Field Validation 8

Provides uasort() callback to sort plugins.

Overrides DefaultLazyPluginCollection::sortHelper

File

src/FieldValidationRulePluginCollection.php, line 24

Class

FieldValidationRulePluginCollection
A collection of FieldValidationRules.

Namespace

Drupal\field_validation

Code

public function sortHelper($aID, $bID) {
  $a_weight = $this
    ->get($aID)
    ->getWeight();
  $b_weight = $this
    ->get($bID)
    ->getWeight();
  if ($a_weight == $b_weight) {
    return 0;
  }
  return $a_weight < $b_weight ? -1 : 1;
}