You are here

public function WidgetsLazyPluginCollection::sortHelper in Entity Browser 8

Same name and namespace in other branches
  1. 8.2 src/WidgetsLazyPluginCollection.php \Drupal\entity_browser\WidgetsLazyPluginCollection::sortHelper()

Provides uasort() callback to sort plugins.

Overrides DefaultLazyPluginCollection::sortHelper

File

src/WidgetsLazyPluginCollection.php, line 15

Class

WidgetsLazyPluginCollection
A collection of entity browser widgets.

Namespace

Drupal\entity_browser

Code

public function sortHelper($a, $b) {
  $weight_a = $this
    ->get($a)
    ->getWeight();
  $weight_b = $this
    ->get($b)
    ->getWeight();
  return $weight_a < $weight_b ? -1 : 1;
}