This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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