You are here

public function ImageEffectPluginCollection::sortHelper in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/image/src/ImageEffectPluginCollection.php \Drupal\image\ImageEffectPluginCollection::sortHelper()

Provides uasort() callback to sort plugins.

Overrides DefaultLazyPluginCollection::sortHelper

File

core/modules/image/src/ImageEffectPluginCollection.php, line 29
Contains \Drupal\image\ImageEffectPluginCollection.

Class

ImageEffectPluginCollection
A collection of image effects.

Namespace

Drupal\image

Code

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