You are here

class FilterShippingMethodsEvent in Commerce Shipping 8.2

Defines the event for filtering the available shipping methods.

Hierarchy

Expanded class hierarchy of FilterShippingMethodsEvent

See also

\Drupal\commerce_shipping\Event\ShippingEvents

2 files declare their use of FilterShippingMethodsEvent
FilterShippingMethodsSubscriber.php in tests/modules/commerce_shipping_test/src/EventSubscriber/FilterShippingMethodsSubscriber.php
ShippingMethodStorage.php in src/ShippingMethodStorage.php

File

src/Event/FilterShippingMethodsEvent.php, line 13

Namespace

Drupal\commerce_shipping\Event
View source
class FilterShippingMethodsEvent extends Event {

  /**
   * The shipping methods.
   *
   * @var \Drupal\commerce_shipping\Entity\ShippingMethodInterface[]
   */
  protected $shippingMethods;

  /**
   * The shipment.
   *
   * @var \Drupal\commerce_shipping\Entity\ShipmentInterface
   */
  protected $shipment;

  /**
   * Constructs a new FilterShippingMethodsEvent object.
   *
   * @param \Drupal\commerce_shipping\Entity\ShippingMethodInterface[] $shipping_methods
   *   The shipping methods.
   * @param \Drupal\commerce_shipping\Entity\ShipmentInterface $shipment
   *   The shipment.
   */
  public function __construct(array $shipping_methods, ShipmentInterface $shipment) {
    $this->shippingMethods = $shipping_methods;
    $this->shipment = $shipment;
  }

  /**
   * Gets the shipping methods.
   *
   * @return \Drupal\commerce_shipping\Entity\ShippingMethodInterface[]
   *   The shipping methods.
   */
  public function getShippingMethods() {
    return $this->shippingMethods;
  }

  /**
   * Sets the shipping methods.
   *
   * @param \Drupal\commerce_shipping\Entity\ShippingMethodInterface[] $shipping_methods
   *   The shipping methods.
   *
   * @return $this
   */
  public function setShippingMethods(array $shipping_methods) {
    $this->shippingMethods = $shipping_methods;
    return $this;
  }

  /**
   * Gets the shipment.
   *
   * @return \Drupal\commerce_shipping\Entity\ShipmentInterface
   *   The shipment.
   */
  public function getShipment() {
    return $this->shipment;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
FilterShippingMethodsEvent::$shipment protected property The shipment.
FilterShippingMethodsEvent::$shippingMethods protected property The shipping methods.
FilterShippingMethodsEvent::getShipment public function Gets the shipment.
FilterShippingMethodsEvent::getShippingMethods public function Gets the shipping methods.
FilterShippingMethodsEvent::setShippingMethods public function Sets the shipping methods.
FilterShippingMethodsEvent::__construct public function Constructs a new FilterShippingMethodsEvent object.