Skip to content

Instantly share code, notes, and snippets.

@a-fro
Created January 16, 2019 17:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save a-fro/069bf464055a769aa466d09e0a04debd to your computer and use it in GitHub Desktop.
Save a-fro/069bf464055a769aa466d09e0a04debd to your computer and use it in GitHub Desktop.
<?php
namespace Drupal\ilr_registrations\EventSubscriber;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\EventDispatcher\Event;
use Drupal\commerce_product\Event\ProductEvents;
use Drupal\commerce_product\Event\FilterVariationsEvent;
/**
* Class ClassFilterSubscriber.
*/
class ClassFilterSubscriber implements EventSubscriberInterface {
/**
* Constructs a new ClassFilterSubscriber object.
*/
public function __construct() {
}
/**
* {@inheritdoc}
*/
static function getSubscribedEvents() {
$events[ProductEvents::FILTER_VARIATIONS] = 'onClassFilter';
return $events;
}
/**
* Code to run before a migration has been imported.
*/
public function onClassFilter(FilterVariationsEvent $event) {
dump($event);
// foreach ($event['#variations'] as $variation) {
// dump($variation);
// }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment