You are here

public function YamlFormHandlerPluginCollection::sortHelper in YAML Form 8

Provides uasort() callback to sort plugins.

Overrides DefaultLazyPluginCollection::sortHelper

File

src/YamlFormHandlerPluginCollection.php, line 22

Class

YamlFormHandlerPluginCollection
A collection of form handlers.

Namespace

Drupal\yamlform

Code

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