@@ -33,20 +33,30 @@ class CustomerMetadata implements CustomerMetadataInterface
33
33
*/
34
34
private $ attributeMetadataDataProvider ;
35
35
36
+ /**
37
+ * List of system attributes which should be available to the clients.
38
+ *
39
+ * @var string[]
40
+ */
41
+ private $ systemAttributes ;
42
+
36
43
/**
37
44
* @param AttributeMetadataConverter $attributeMetadataConverter
38
45
* @param AttributeMetadataDataProvider $attributeMetadataDataProvider
46
+ * @param string[] $systemAttributes
39
47
*/
40
48
public function __construct (
41
49
AttributeMetadataConverter $ attributeMetadataConverter ,
42
- AttributeMetadataDataProvider $ attributeMetadataDataProvider
50
+ AttributeMetadataDataProvider $ attributeMetadataDataProvider ,
51
+ array $ systemAttributes = []
43
52
) {
44
53
$ this ->attributeMetadataConverter = $ attributeMetadataConverter ;
45
54
$ this ->attributeMetadataDataProvider = $ attributeMetadataDataProvider ;
55
+ $ this ->systemAttributes = $ systemAttributes ;
46
56
}
47
57
48
58
/**
49
- * { @inheritdoc}
59
+ * @inheritdoc
50
60
*/
51
61
public function getAttributes ($ formCode )
52
62
{
@@ -67,7 +77,7 @@ public function getAttributes($formCode)
67
77
}
68
78
69
79
/**
70
- * { @inheritdoc}
80
+ * @inheritdoc
71
81
*/
72
82
public function getAttributeMetadata ($ attributeCode )
73
83
{
@@ -92,7 +102,7 @@ public function getAttributeMetadata($attributeCode)
92
102
}
93
103
94
104
/**
95
- * { @inheritdoc}
105
+ * @inheritdoc
96
106
*/
97
107
public function getAllAttributesMetadata ()
98
108
{
@@ -116,7 +126,7 @@ public function getAllAttributesMetadata()
116
126
}
117
127
118
128
/**
119
- * { @inheritdoc}
129
+ * @inheritdoc
120
130
*/
121
131
public function getCustomAttributesMetadata ($ dataObjectClassName = self ::DATA_INTERFACE_NAME )
122
132
{
@@ -134,9 +144,10 @@ public function getCustomAttributesMetadata($dataObjectClassName = self::DATA_IN
134
144
$ isDataObjectMethod = isset ($ this ->customerDataObjectMethods ['get ' . $ camelCaseKey ])
135
145
|| isset ($ this ->customerDataObjectMethods ['is ' . $ camelCaseKey ]);
136
146
137
- /** Even though disable_auto_group_change is system attribute, it should be available to the clients */
138
147
if (!$ isDataObjectMethod
139
- && (!$ attributeMetadata ->isSystem () || $ attributeCode == 'disable_auto_group_change ' )
148
+ && (!$ attributeMetadata ->isSystem ()
149
+ || in_array ($ attributeCode , $ this ->systemAttributes )
150
+ )
140
151
) {
141
152
$ customAttributes [] = $ attributeMetadata ;
142
153
}
0 commit comments