/
ProductVariationType.php
107 lines (97 loc) · 3.1 KB
/
ProductVariationType.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<?php
namespace Drupal\commerce_product\Entity;
use Drupal\commerce\Entity\CommerceBundleEntityBase;
/**
* Defines the product variation type entity class.
*
* @ConfigEntityType(
* id = "commerce_product_variation_type",
* label = @Translation("Product variation type"),
* label_collection = @Translation("Product variation types"),
* label_singular = @Translation("product variation type"),
* label_plural = @Translation("product variation types"),
* label_count = @PluralTranslation(
* singular = "@count product variation type",
* plural = "@count product variation types",
* ),
* handlers = {
* "access" = "Drupal\commerce_product\ProductVariationTypeAccessControlHandler",
* "list_builder" = "Drupal\commerce_product\ProductVariationTypeListBuilder",
* "form" = {
* "add" = "Drupal\commerce_product\Form\ProductVariationTypeForm",
* "edit" = "Drupal\commerce_product\Form\ProductVariationTypeForm",
* "duplicate" = "Drupal\commerce_product\Form\ProductVariationTypeForm",
* "delete" = "Drupal\commerce\Form\CommerceBundleEntityDeleteFormBase"
* },
* "local_task_provider" = {
* "default" = "Drupal\entity\Menu\DefaultEntityLocalTaskProvider",
* },
* "route_provider" = {
* "default" = "Drupal\entity\Routing\DefaultHtmlRouteProvider",
* },
* },
* config_prefix = "commerce_product_variation_type",
* admin_permission = "administer commerce_product_type",
* bundle_of = "commerce_product_variation",
* entity_keys = {
* "id" = "id",
* "label" = "label",
* "uuid" = "uuid"
* },
* config_export = {
* "id",
* "label",
* "orderItemType",
* "generateTitle",
* "traits",
* "locked",
* },
* links = {
* "add-form" = "/admin/commerce/config/product-variation-types/add",
* "edit-form" = "/admin/commerce/config/product-variation-types/{commerce_product_variation_type}/edit",
* "duplicate-form" = "/admin/commerce/config/product-variation-types/{commerce_product_variation_type}/duplicate",
* "delete-form" = "/admin/commerce/config/product-variation-types/{commerce_product_variation_type}/delete",
* "collection" = "/admin/commerce/config/product-variation-types"
* }
* )
*/
class ProductVariationType extends CommerceBundleEntityBase implements ProductVariationTypeInterface {
/**
* The order item type ID.
*
* @var string
*/
protected $orderItemType;
/**
* Whether the product variation title should be automatically generated.
*
* @var bool
*/
protected $generateTitle;
/**
* {@inheritdoc}
*/
public function getOrderItemTypeId() {
return $this->orderItemType;
}
/**
* {@inheritdoc}
*/
public function setOrderItemTypeId($order_item_type_id) {
$this->orderItemType = $order_item_type_id;
return $this;
}
/**
* {@inheritdoc}
*/
public function shouldGenerateTitle() {
return (bool) $this->generateTitle;
}
/**
* {@inheritdoc}
*/
public function setGenerateTitle($generate_title) {
$this->generateTitle = $generate_title;
return $this;
}
}