ImageEffectPluginCollection.php 643 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. namespace Drupal\image;
  3. use Drupal\Core\Plugin\DefaultLazyPluginCollection;
  4. /**
  5. * A collection of image effects.
  6. */
  7. class ImageEffectPluginCollection extends DefaultLazyPluginCollection {
  8. /**
  9. * {@inheritdoc}
  10. *
  11. * @return \Drupal\image\ImageEffectInterface
  12. */
  13. public function &get($instance_id) {
  14. return parent::get($instance_id);
  15. }
  16. /**
  17. * {@inheritdoc}
  18. */
  19. public function sortHelper($aID, $bID) {
  20. $a_weight = $this->get($aID)->getWeight();
  21. $b_weight = $this->get($bID)->getWeight();
  22. if ($a_weight == $b_weight) {
  23. return 0;
  24. }
  25. return ($a_weight < $b_weight) ? -1 : 1;
  26. }
  27. }