You are here

public function WidgetsCollection::sortHelper in Entity Browser 8.2

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

Provides uasort() callback to sort plugins.

Overrides DefaultLazyPluginCollection::sortHelper

File

src/WidgetsCollection.php, line 15

Class

WidgetsCollection
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;
}