You are here

class ProductVariationAjaxChangeEvent in Commerce Core 8.2

Defines the product variation ajax change event.

Hierarchy

Expanded class hierarchy of ProductVariationAjaxChangeEvent

See also

\Drupal\commerce_product\Event\ProductEvents

1 file declares its use of ProductVariationAjaxChangeEvent
ProductVariationWidgetBase.php in modules/product/src/Plugin/Field/FieldWidget/ProductVariationWidgetBase.php

File

modules/product/src/Event/ProductVariationAjaxChangeEvent.php, line 14

Namespace

Drupal\commerce_product\Event
View source
class ProductVariationAjaxChangeEvent extends EventBase {

  /**
   * The product variation.
   *
   * @var \Drupal\commerce_product\Entity\ProductVariationInterface
   */
  protected $productVariation;

  /**
   * The ajax response.
   *
   * @var \Drupal\Core\Ajax\AjaxResponse
   */
  protected $response;

  /**
   * The view mode.
   *
   * @var string
   */
  protected $viewMode;

  /**
   * Constructs a new ProductVariationAjaxChangeEvent.
   *
   * @param \Drupal\commerce_product\Entity\ProductVariationInterface $product_variation
   *   The product variation.
   * @param \Drupal\Core\Ajax\AjaxResponse $response
   *   The ajax response.
   * @param string $view_mode
   *   The view mode used to render the product variation.
   */
  public function __construct(ProductVariationInterface $product_variation, AjaxResponse $response, $view_mode = 'default') {
    $this->productVariation = $product_variation;
    $this->response = $response;
    $this->viewMode = $view_mode;
  }

  /**
   * The product variation.
   *
   * @return \Drupal\commerce_product\Entity\ProductVariationInterface
   *   The product variation.
   */
  public function getProductVariation() {
    return $this->productVariation;
  }

  /**
   * The ajax response.
   *
   * @return \Drupal\Core\Ajax\AjaxResponse
   *   The ajax reponse.
   */
  public function getResponse() {
    return $this->response;
  }

  /**
   * The view mode used to render the product variation.
   *
   * @return string
   *   The view mode.
   */
  public function getViewMode() {
    return $this->viewMode;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
ProductVariationAjaxChangeEvent::$productVariation protected property The product variation.
ProductVariationAjaxChangeEvent::$response protected property The ajax response.
ProductVariationAjaxChangeEvent::$viewMode protected property The view mode.
ProductVariationAjaxChangeEvent::getProductVariation public function The product variation.
ProductVariationAjaxChangeEvent::getResponse public function The ajax response.
ProductVariationAjaxChangeEvent::getViewMode public function The view mode used to render the product variation.
ProductVariationAjaxChangeEvent::__construct public function Constructs a new ProductVariationAjaxChangeEvent.