Skip to content
This repository was archived by the owner on Apr 29, 2019. It is now read-only.

Commit 84e583a

Browse files
[EngCom] Public Pull Requests - 2.3-develop
- merged latest code from mainline branch
2 parents aa81015 + f032485 commit 84e583a

File tree

2 files changed

+15
-7
lines changed

2 files changed

+15
-7
lines changed

app/code/Magento/Customer/Model/Customer/DataProvider.php

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,13 @@
2525
use Magento\Framework\Session\SessionManagerInterface;
2626
use Magento\Framework\View\Element\UiComponent\ContextInterface;
2727
use Magento\Framework\View\Element\UiComponent\DataProvider\FilterPool;
28+
use Magento\Ui\Component\Form\Element\Multiline;
2829
use Magento\Ui\Component\Form\Field;
2930
use Magento\Ui\DataProvider\EavValidationRules;
3031

3132
/**
33+
* Supplies the data for the customer UI component
34+
*
3235
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
3336
*
3437
* @api
@@ -155,10 +158,11 @@ class DataProvider extends \Magento\Ui\DataProvider\AbstractDataProvider
155158
* @param Config $eavConfig
156159
* @param FilterPool $filterPool
157160
* @param FileProcessorFactory $fileProcessorFactory
158-
* @param ContextInterface $context
159161
* @param array $meta
160162
* @param array $data
163+
* @param ContextInterface $context
161164
* @param bool $allowToShowHiddenAttributes
165+
* @throws \Magento\Framework\Exception\LocalizedException
162166
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
163167
*/
164168
public function __construct(
@@ -596,8 +600,14 @@ protected function prepareAddressData($addressId, array &$addresses, array $cust
596600
) {
597601
$addresses[$addressId]['default_shipping'] = $customer['default_shipping'];
598602
}
599-
if (isset($addresses[$addressId]['street']) && !is_array($addresses[$addressId]['street'])) {
600-
$addresses[$addressId]['street'] = explode("\n", $addresses[$addressId]['street']);
603+
604+
foreach ($this->meta['address']['children'] as $attributeName => $attributeMeta) {
605+
if ($attributeMeta['arguments']['data']['config']['dataType'] === Multiline::NAME
606+
&& isset($addresses[$addressId][$attributeName])
607+
&& !is_array($addresses[$addressId][$attributeName])
608+
) {
609+
$addresses[$addressId][$attributeName] = explode("\n", $addresses[$addressId][$attributeName]);
610+
}
601611
}
602612
}
603613

app/code/Magento/Customer/Test/Unit/Model/Customer/DataProviderTest.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -649,10 +649,8 @@ public function testGetData()
649649
2 => [
650650
'firstname' => 'firstname',
651651
'lastname' => 'lastname',
652-
'street' => [
653-
'street',
654-
'street',
655-
],
652+
// Won't be an array because it isn't defined as a multiline field in this test
653+
'street' => "street\nstreet",
656654
'default_billing' => 2,
657655
'default_shipping' => 2,
658656
]

0 commit comments

Comments
 (0)