Guest User

Untitled

a guest
Jan 17th, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. <?php
  2.  
  3. namespace Drupal\ilr_registrations\EventSubscriber;
  4.  
  5. use Symfony\Component\EventDispatcher\EventSubscriberInterface;
  6. use Symfony\Component\EventDispatcher\Event;
  7. use Drupal\commerce_product\Event\ProductEvents;
  8. use Drupal\commerce_product\Event\FilterVariationsEvent;
  9.  
  10. /**
  11. * Class ClassFilterSubscriber.
  12. */
  13. class ClassFilterSubscriber implements EventSubscriberInterface {
  14.  
  15.  
  16. /**
  17. * Constructs a new ClassFilterSubscriber object.
  18. */
  19. public function __construct() {
  20.  
  21. }
  22.  
  23. /**
  24. * {@inheritdoc}
  25. */
  26. static function getSubscribedEvents() {
  27. $events[ProductEvents::FILTER_VARIATIONS] = 'onClassFilter';
  28. return $events;
  29. }
  30.  
  31. /**
  32. * Code to run before a migration has been imported.
  33. */
  34. public function onClassFilter(FilterVariationsEvent $event) {
  35. dump($event);
  36. // foreach ($event['#variations'] as $variation) {
  37. // dump($variation);
  38. // }
  39.  
  40. }
  41. }
Add Comment
Please, Sign In to add comment