public function PackageType::__construct in Commerce Shipping 8.2
Constructs a new PackageType 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.
Overrides PluginBase::__construct
File
- src/
Plugin/ Commerce/ PackageType/ PackageType.php, line 52
Class
- PackageType
- Defines the class for package types.
Namespace
Drupal\commerce_shipping\Plugin\Commerce\PackageTypeCode
public function __construct(array $configuration, $plugin_id, $plugin_definition) {
parent::__construct($configuration, $plugin_id, $plugin_definition);
$dimensions = $plugin_definition['dimensions'];
$this->length = new Length($dimensions['length'], $dimensions['unit']);
$this->width = new Length($dimensions['width'], $dimensions['unit']);
$this->height = new Length($dimensions['height'], $dimensions['unit']);
$weight = $plugin_definition['weight'];
$this->weight = new Weight($weight['number'], $weight['unit']);
}