You are here

public function ShippingByWeight::__construct in Commerce Shipping Weight Tariff 8

Same name and namespace in other branches
  1. 8.2 src/Plugin/Commerce/ShippingMethod/ShippingByWeight.php \Drupal\commerce_shipping_weight_tariff\Plugin\Commerce\ShippingMethod\ShippingByWeight::__construct()

Constructs a new ShippingByWeight object.

Parameters

array $configuration: A configuration array containing information about the plugin instance.

string $plugin_id: The plugin_id for the plugin instance.

mixed $plugin_definition: The plugin implementation definition.

\Drupal\commerce_shipping\PackageTypeManagerInterface $package_type_manager: The package type manager.

\Drupal\Core\State\StateInterface $stateService: The Drupal State Service.

\Drupal\state_machine\WorkflowManagerInterface $workflow_manager: The workflow manager.

Overrides ShippingMethodBase::__construct

File

src/Plugin/Commerce/ShippingMethod/ShippingByWeight.php, line 44

Class

ShippingByWeight
Provides the FlatRatePerItem shipping method.

Namespace

Drupal\commerce_shipping_weight_tariff\Plugin\Commerce\ShippingMethod

Code

public function __construct(array $configuration, $plugin_id, $plugin_definition, PackageTypeManagerInterface $package_type_manager, WorkflowManagerInterface $workflow_manager, StateInterface $stateService) {
  parent::__construct($configuration, $plugin_id, $plugin_definition, $package_type_manager, $workflow_manager);
  $this->services['default'] = new ShippingService('default', $this->configuration['rate_label']);
  $this->stateService = $stateService;
}