@@ -281,7 +281,13 @@ public function setData($key, $value = null)
281
281
$ key = $ this ->_implodeArrayField ($ key );
282
282
} elseif (is_array ($ value ) && $ this ->isAddressMultilineAttribute ($ key )) {
283
283
$ value = $ this ->_implodeArrayValues ($ value );
284
+ } elseif (self ::CUSTOM_ATTRIBUTES === $ key && is_array ($ value )) {
285
+ foreach ($ value as &$ attribute ) {
286
+ $ attribute = is_array ($ attribute ) ? $ attribute : $ attribute ->__toArray ();
287
+ $ attribute = $ this ->processCustomAttribute ($ attribute );
288
+ }
284
289
}
290
+
285
291
return parent ::setData ($ key , $ value );
286
292
}
287
293
@@ -637,8 +643,8 @@ public function unsRegion()
637
643
* Is company required
638
644
*
639
645
* @return bool
640
- * @since 100.2.0
641
646
* @throws \Magento\Framework\Exception\LocalizedException
647
+ * @since 100.2.0
642
648
*/
643
649
protected function isCompanyRequired ()
644
650
{
@@ -649,8 +655,8 @@ protected function isCompanyRequired()
649
655
* Is telephone required
650
656
*
651
657
* @return bool
652
- * @since 100.2.0
653
658
* @throws \Magento\Framework\Exception\LocalizedException
659
+ * @since 100.2.0
654
660
*/
655
661
protected function isTelephoneRequired ()
656
662
{
@@ -661,11 +667,30 @@ protected function isTelephoneRequired()
661
667
* Is fax required
662
668
*
663
669
* @return bool
664
- * @since 100.2.0
665
670
* @throws \Magento\Framework\Exception\LocalizedException
671
+ * @since 100.2.0
666
672
*/
667
673
protected function isFaxRequired ()
668
674
{
669
675
return ($ this ->_eavConfig ->getAttribute ('customer_address ' , 'fax ' )->getIsRequired ());
670
676
}
677
+
678
+ /**
679
+ * Unify attribute format.
680
+ *
681
+ * @param array $attribute
682
+ * @return array
683
+ */
684
+ private function processCustomAttribute (array $ attribute ): array
685
+ {
686
+ if (isset ($ attribute ['attribute_code ' ]) &&
687
+ isset ($ attribute ['value ' ]) &&
688
+ is_array ($ attribute ['value ' ]) &&
689
+ $ this ->isAddressMultilineAttribute ($ attribute ['attribute_code ' ])
690
+ ) {
691
+ $ attribute ['value ' ] = $ this ->_implodeArrayValues ($ attribute ['value ' ]);
692
+ }
693
+
694
+ return $ attribute ;
695
+ }
671
696
}
0 commit comments