Skip to content

Commit f717df9

Browse files
authored
ENGCOM-4146: Fixed #17861 Customer Name Prefix shows white space when extra separator is addes #20896
2 parents 267d4d8 + bf9589e commit f717df9

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

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

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@
88
use Magento\Config\Model\Config\Source\Nooptreq as NooptreqSource;
99
use Magento\Customer\Helper\Address as AddressHelper;
1010
use Magento\Framework\Escaper;
11+
use Magento\Store\Api\Data\StoreInterface;
1112

13+
/**
14+
* Customer Options.
15+
*/
1216
class Options
1317
{
1418
/**
@@ -38,7 +42,7 @@ public function __construct(
3842
/**
3943
* Retrieve name prefix dropdown options
4044
*
41-
* @param null $store
45+
* @param null|string|bool|int|StoreInterface $store
4246
* @return array|bool
4347
*/
4448
public function getNamePrefixOptions($store = null)
@@ -52,7 +56,7 @@ public function getNamePrefixOptions($store = null)
5256
/**
5357
* Retrieve name suffix dropdown options
5458
*
55-
* @param null $store
59+
* @param null|string|bool|int|StoreInterface $store
5660
* @return array|bool
5761
*/
5862
public function getNameSuffixOptions($store = null)
@@ -64,7 +68,9 @@ public function getNameSuffixOptions($store = null)
6468
}
6569

6670
/**
67-
* @param $options
71+
* Unserialize and clear name prefix or suffix options.
72+
*
73+
* @param string $options
6874
* @param bool $isOptional
6975
* @return array|bool
7076
*
@@ -78,6 +84,7 @@ protected function _prepareNamePrefixSuffixOptions($options, $isOptional = false
7884

7985
/**
8086
* Unserialize and clear name prefix or suffix options
87+
*
8188
* If field is optional, add an empty first option.
8289
*
8390
* @param string $options
@@ -91,7 +98,7 @@ private function prepareNamePrefixSuffixOptions($options, $isOptional = false)
9198
return false;
9299
}
93100
$result = [];
94-
$options = explode(';', $options);
101+
$options = array_filter(explode(';', $options));
95102
foreach ($options as $value) {
96103
$value = $this->escaper->escapeHtml(trim($value));
97104
$result[$value] = $value;

0 commit comments

Comments
 (0)