class CartEventSubscriber in Commerce Product Bundle 8
Hierarchy
- class \Drupal\commerce_product_bundle_cart\EventSubscriber\CartEventSubscriber implements \Symfony\Component\EventDispatcher\EventSubscriberInterface
Expanded class hierarchy of CartEventSubscriber
File
- modules/
commerce_product_bundle_cart/ src/ EventSubscriber/ CartEventSubscriber.php, line 10
Namespace
Drupal\commerce_product_bundle_cart\EventSubscriberView source
class CartEventSubscriber implements EventSubscriberInterface {
/**
* {@inheritdoc}
*/
public static function getSubscribedEvents() {
$events = [
CartEvents::ORDER_ITEM_COMPARISON_FIELDS => 'filterOrderItemComparisonFields',
];
return $events;
}
/**
* Tries to jump to checkout, skipping cart after adding certain items.
*
* @param \Drupal\commerce_cart\Event\OrderItemComparisonFieldsEvent $event
* The order item comparison fields event.
*/
public function filterOrderItemComparisonFields(OrderItemComparisonFieldsEvent $event) {
if ($event
->getOrderItem()
->getPurchasedEntity() instanceof BundleInterface) {
$fields = $event
->getComparisonFields();
$fields[] = 'bundle_order_item_reference';
$event
->setComparisonFields($fields);
}
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
CartEventSubscriber:: |
public | function | Tries to jump to checkout, skipping cart after adding certain items. | |
CartEventSubscriber:: |
public static | function |