From ef94d4fc01365ce7c1e87e782187bbfca497a1c9 Mon Sep 17 00:00:00 2001 From: Andreus Timm Date: Thu, 12 Nov 2020 15:08:25 -0300 Subject: [PATCH 1/2] Bugfix - Payment Method without label position in the array --- .../Magento/Backend/Block/Widget/Grid/Column/Filter/Select.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Select.php b/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Select.php index 98e4a3310fac7..e7370a8efaebb 100644 --- a/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Select.php +++ b/app/code/Magento/Backend/Block/Widget/Grid/Column/Filter/Select.php @@ -72,7 +72,8 @@ public function getHtml() $value = $this->getValue(); foreach ($this->_getOptions() as $option) { if (is_array($option['value'])) { - $html .= ''; + $label = isset($option['label']) ? $option['label'] : ''; + $html .= ''; foreach ($option['value'] as $subOption) { $html .= $this->_renderOption($subOption, $value); } From a4f64f7042a91bb3db77fc4d5e176e223eed7174 Mon Sep 17 00:00:00 2001 From: Andreus Timm Date: Fri, 13 Nov 2020 17:54:33 -0300 Subject: [PATCH 2/2] Bugfix - Payment Method without label position in the array --- .../Framework/Data/Form/Element/Select.php | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/lib/internal/Magento/Framework/Data/Form/Element/Select.php b/lib/internal/Magento/Framework/Data/Form/Element/Select.php index e0563c6fa75ad..e951287090df0 100644 --- a/lib/internal/Magento/Framework/Data/Form/Element/Select.php +++ b/lib/internal/Magento/Framework/Data/Form/Element/Select.php @@ -86,8 +86,9 @@ public function getElementHtml() foreach ($values as $key => $option) { if (!is_array($option)) { $html .= $this->_optionToHtml(['value' => $key, 'label' => $option], $value); - } elseif (is_array($option['value'])) { - $html .= '' . "\n"; + } elseif (isset($option['value']) && is_array($option['value'])) { + $label = isset($option['label']) ? $option['label'] : ''; + $html .= '' . "\n"; foreach ($option['value'] as $groupItem) { $html .= $this->_optionToHtml($groupItem, $value); } @@ -119,24 +120,35 @@ public function getElementHtml() */ protected function _optionToHtml($option, $selected) { - if (is_array($option['value'])) { + if (isset($option['value']) && is_array($option['value'])) { + $label = isset($option['label']) ? $option['label'] : ''; $html = '' . "\n"; + foreach ($option['value'] as $groupItem) { $html .= $this->_optionToHtml($groupItem, $selected); } + $html .= '' . "\n"; } else { + $value = isset($option['value']) ? $option['value'] : ''; + $label = isset($option['label']) ? $option['label'] : ''; + $optionId = 'optId' .$this->random->getRandomString(8); - $html = '' . "\n"; + + $html .= '>' . $this->_escape($label) . '' . "\n"; + if (!empty($option['style'])) { $html .= $this->secureRenderer->renderStyleAsTag($option['style'], "#$optionId"); } } + return $html; }