@@ -307,45 +307,17 @@ protected function getAttributesMeta(Type $entityType)
307
307
return $ meta ;
308
308
}
309
309
310
- /**
311
- * Check whether the specific attribute can be shown in form: customer registration, customer edit, etc...
312
- *
313
- * @param Attribute $customerAttribute
314
- * @return bool
315
- */
316
- private function canShowAttributeInForm (AbstractAttribute $ customerAttribute )
317
- {
318
- $ isRegistration = $ this ->context ->getRequestParam ($ this ->getRequestFieldName ()) === null ;
319
-
320
- if ($ customerAttribute ->getEntityType ()->getEntityTypeCode () === 'customer ' ) {
321
- return is_array ($ customerAttribute ->getUsedInForms ()) &&
322
- (
323
- (in_array ('customer_account_create ' , $ customerAttribute ->getUsedInForms ()) && $ isRegistration ) ||
324
- (in_array ('customer_account_edit ' , $ customerAttribute ->getUsedInForms ()) && !$ isRegistration )
325
- );
326
- } else {
327
- return is_array ($ customerAttribute ->getUsedInForms ()) &&
328
- in_array ('customer_address_edit ' , $ customerAttribute ->getUsedInForms ());
329
- }
330
- }
331
-
332
310
/**
333
311
* Detect can we show attribute on specific form or not
334
312
*
335
313
* @param Attribute $customerAttribute
336
314
* @return bool
337
315
*/
338
- private function canShowAttribute (AbstractAttribute $ customerAttribute )
316
+ private function canShowAttribute (AbstractAttribute $ customerAttribute ): bool
339
317
{
340
- $ userDefined = (bool ) $ customerAttribute ->getIsUserDefined ();
341
- if (!$ userDefined ) {
342
- return $ customerAttribute ->getIsVisible ();
343
- }
344
-
345
- $ canShowOnForm = $ this ->canShowAttributeInForm ($ customerAttribute );
346
-
347
- return ($ this ->allowToShowHiddenAttributes && $ canShowOnForm ) ||
348
- (!$ this ->allowToShowHiddenAttributes && $ canShowOnForm && $ customerAttribute ->getIsVisible ());
318
+ return $ this ->allowToShowHiddenAttributes && (bool ) $ customerAttribute ->getIsUserDefined ()
319
+ ? true
320
+ : (bool ) $ customerAttribute ->getIsVisible ();
349
321
}
350
322
351
323
/**
0 commit comments