function VariantPluginCollection::sortHelper

Same name in other branches
  1. 4.0.x src/Plugin/VariantPluginCollection.php \Drupal\ctools\Plugin\VariantPluginCollection::sortHelper()

Overrides DefaultLazyPluginCollection::sortHelper

File

src/Plugin/VariantPluginCollection.php, line 33

Class

VariantPluginCollection
Provides a collection of variants plugins.

Namespace

Drupal\ctools\Plugin

Code

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