public function MatcherCollection::sortHelper in Linkit 8.4
Same name and namespace in other branches
- 8.5 src/MatcherCollection.php \Drupal\linkit\MatcherCollection::sortHelper()
Provides uasort() callback to sort plugins.
Overrides DefaultLazyPluginCollection::sortHelper
File
- src/
MatcherCollection.php, line 36 - Contains \Drupal\linkit\MatcherCollection.
Class
- MatcherCollection
- A collection of matchers.
Namespace
Drupal\linkitCode
public function sortHelper($aID, $bID) {
$a_weight = $this
->get($aID)
->getWeight();
$b_weight = $this
->get($bID)
->getWeight();
if ($a_weight == $b_weight) {
return strnatcasecmp($this
->get($aID)
->getLabel(), $this
->get($bID)
->getLabel());
}
return $a_weight < $b_weight ? -1 : 1;
}