class AlterProductEvent in Commerce Google Tag Manager 8
Same name and namespace in other branches
- 8.2 src/Event/AlterProductEvent.php \Drupal\commerce_google_tag_manager\Event\AlterProductEvent
Event to alter the Enhanced Ecommerce product.
Event to alter product mapped from a commerce product variation.
Hierarchy
- class \Drupal\commerce_google_tag_manager\Event\AlterProductEvent extends \Symfony\Component\EventDispatcher\Event
Expanded class hierarchy of AlterProductEvent
2 files declare their use of AlterProductEvent
- AlterProductEventTest.php in tests/
src/ Kernel/ AlterProductEventTest.php - EventTrackerService.php in src/
EventTrackerService.php
File
- src/
Event/ AlterProductEvent.php, line 14
Namespace
Drupal\commerce_google_tag_manager\EventView source
class AlterProductEvent extends Event {
/**
* The Commerce GTM product class.
*
* @var \Drupal\commerce_google_tag_manager\Product
*/
private $product;
/**
* The Commerce production variation.
*
* @var \Drupal\commerce_product\Entity\ProductVariationInterface
*/
private $productVariation;
/**
* Constructs a AlterProductEvent object.
*
* @param \Drupal\commerce_google_tag_manager\Product $product
* The Commerce GTM product class.
* @param \Drupal\commerce_product\Entity\ProductVariationInterface $product_variation
* The Commerce production variation.
*/
public function __construct(Product $product, ProductVariationInterface $product_variation) {
$this->product = $product;
$this->productVariation = $product_variation;
}
/**
* Get the product.
*
* @return \Drupal\commerce_google_tag_manager\Product
* The Commerce GTM product object.
*/
public function getProduct() {
return $this->product;
}
/**
* Get the product variation.
*
* @return \Drupal\commerce_product\Entity\ProductVariationInterface
* The product variation object.
*/
public function getProductVariation() {
return $this->productVariation;
}
}
Members
Name![]() |
Modifiers | Type | Description | Overrides |
---|---|---|---|---|
AlterProductEvent:: |
private | property | The Commerce GTM product class. | |
AlterProductEvent:: |
private | property | The Commerce production variation. | |
AlterProductEvent:: |
public | function | Get the product. | |
AlterProductEvent:: |
public | function | Get the product variation. | |
AlterProductEvent:: |
public | function | Constructs a AlterProductEvent object. |