You are here

public function ShippingMethodBase::__construct in Commerce Shipping 8.2

Constructs a new ShippingMethodBase 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\state_machine\WorkflowManagerInterface $workflow_manager: The workflow manager.

Overrides PluginBase::__construct

1 call to ShippingMethodBase::__construct()
FlatRate::__construct in src/Plugin/Commerce/ShippingMethod/FlatRate.php
Constructs a new FlatRate object.
1 method overrides ShippingMethodBase::__construct()
FlatRate::__construct in src/Plugin/Commerce/ShippingMethod/FlatRate.php
Constructs a new FlatRate object.

File

src/Plugin/Commerce/ShippingMethod/ShippingMethodBase.php, line 66

Class

ShippingMethodBase
Provides the base class for shipping methods.

Namespace

Drupal\commerce_shipping\Plugin\Commerce\ShippingMethod

Code

public function __construct(array $configuration, $plugin_id, $plugin_definition, PackageTypeManagerInterface $package_type_manager, WorkflowManagerInterface $workflow_manager) {
  parent::__construct($configuration, $plugin_id, $plugin_definition);
  $this->packageTypeManager = $package_type_manager;
  $this->workflowManager = $workflow_manager;
  foreach ($this->pluginDefinition['services'] as $id => $label) {
    $this->services[$id] = new ShippingService($id, (string) $label);
  }
  $this
    ->setConfiguration($configuration);
}