Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?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