@@ -101,15 +101,13 @@ public function __construct(
101
101
* @param AbstractAttribute $attribute
102
102
* @param Type $entityType
103
103
* @param bool $allowToShowHiddenAttributes
104
- * @param string $requestFieldName
105
104
* @return array
106
105
* @throws \Magento\Framework\Exception\LocalizedException
107
106
*/
108
107
public function getAttributesMeta (
109
108
AbstractAttribute $ attribute ,
110
109
Type $ entityType ,
111
- bool $ allowToShowHiddenAttributes ,
112
- string $ requestFieldName
110
+ bool $ allowToShowHiddenAttributes
113
111
): array {
114
112
$ meta = $ this ->modifyBooleanAttributeMeta ($ attribute );
115
113
// use getDataUsingMethod, since some getters are defined and apply additional processing of returning value
@@ -138,7 +136,6 @@ public function getAttributesMeta(
138
136
$ meta ['arguments ' ]['data ' ]['config ' ]['componentType ' ] = Field::NAME ;
139
137
$ meta ['arguments ' ]['data ' ]['config ' ]['visible ' ] = $ this ->canShowAttribute (
140
138
$ attribute ,
141
- $ requestFieldName ,
142
139
$ allowToShowHiddenAttributes
143
140
);
144
141
@@ -155,48 +152,16 @@ public function getAttributesMeta(
155
152
* Detect can we show attribute on specific form or not
156
153
*
157
154
* @param AbstractAttribute $customerAttribute
158
- * @param string $requestFieldName
159
155
* @param bool $allowToShowHiddenAttributes
160
156
* @return bool
161
157
*/
162
158
private function canShowAttribute (
163
159
AbstractAttribute $ customerAttribute ,
164
- string $ requestFieldName ,
165
160
bool $ allowToShowHiddenAttributes
166
161
) {
167
- $ userDefined = (bool )$ customerAttribute ->getIsUserDefined ();
168
- if (!$ userDefined ) {
169
- return $ customerAttribute ->getIsVisible ();
170
- }
171
-
172
- $ canShowOnForm = $ this ->canShowAttributeInForm ($ customerAttribute , $ requestFieldName );
173
-
174
- return ($ allowToShowHiddenAttributes && $ canShowOnForm ) ||
175
- (!$ allowToShowHiddenAttributes && $ canShowOnForm && $ customerAttribute ->getIsVisible ());
176
- }
177
-
178
- /**
179
- * Check whether the specific attribute can be shown in form: customer registration, customer edit, etc...
180
- *
181
- * @param AbstractAttribute $customerAttribute
182
- * @param string $requestFieldName
183
- * @return bool
184
- */
185
- private function canShowAttributeInForm (AbstractAttribute $ customerAttribute , string $ requestFieldName ): bool
186
- {
187
- $ isRegistration = $ this ->context ->getRequestParam ($ requestFieldName ) === null ;
188
-
189
- if ($ customerAttribute ->getEntityType ()->getEntityTypeCode () === 'customer ' ) {
190
- return \is_array ($ customerAttribute ->getUsedInForms ()) &&
191
- (
192
- (\in_array ('customer_account_create ' , $ customerAttribute ->getUsedInForms (), true )
193
- && $ isRegistration ) ||
194
- (\in_array ('customer_account_edit ' , $ customerAttribute ->getUsedInForms (), true )
195
- && !$ isRegistration )
196
- );
197
- }
198
- return \is_array ($ customerAttribute ->getUsedInForms ()) &&
199
- \in_array ('customer_address_edit ' , $ customerAttribute ->getUsedInForms (), true );
162
+ return $ allowToShowHiddenAttributes && (bool ) $ customerAttribute ->getIsUserDefined ()
163
+ ? true
164
+ : (bool ) $ customerAttribute ->getIsVisible ();
200
165
}
201
166
202
167
/**
0 commit comments