Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions app/code/Magento/Customer/Model/Options.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@
use Magento\Customer\Helper\Address as AddressHelper;
use Magento\Framework\Escaper;

/**
* Class Options
*
* @package Magento\Customer\Model
*/
class Options
{
/**
Expand Down Expand Up @@ -38,7 +43,7 @@ public function __construct(
/**
* Retrieve name prefix dropdown options
*
* @param null $store
* @param string|null $store
* @return array|bool
*/
public function getNamePrefixOptions($store = null)
Expand All @@ -52,7 +57,7 @@ public function getNamePrefixOptions($store = null)
/**
* Retrieve name suffix dropdown options
*
* @param null $store
* @param string|null $store
* @return array|bool
*/
public function getNameSuffixOptions($store = null)
Expand All @@ -64,7 +69,9 @@ public function getNameSuffixOptions($store = null)
}

/**
* @param $options
* Prepare Name Suffix Options
*
* @param string|null $options
* @param bool $isOptional
* @return array|bool
*
Expand All @@ -78,6 +85,7 @@ protected function _prepareNamePrefixSuffixOptions($options, $isOptional = false

/**
* Unserialize and clear name prefix or suffix options
*
* If field is optional, add an empty first option.
*
* @param string $options
Expand All @@ -95,6 +103,7 @@ private function prepareNamePrefixSuffixOptions($options, $isOptional = false)
foreach ($options as $value) {
$value = $this->escaper->escapeHtml(trim($value));
$result[$value] = $value;
$result = array_filter($result);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please move this outside the loop.

}
if ($isOptional && trim(current($options))) {
$result = array_merge([' ' => ' '], $result);
Expand Down