diff --git a/Helper/Data.php b/Helper/Data.php index 4814772..1fbd160 100644 --- a/Helper/Data.php +++ b/Helper/Data.php @@ -113,15 +113,25 @@ public function getConfigDisplayValue($path, $contextScope, $contextScopeId) { $labels = []; //reset labels so we can add human-friendly labels $optionsByValue = []; - foreach($field->getOptions() as $option) { - $optionsByValue[$option['value']] = $option; + foreach($field->getOptions() as $optionValue => $option) { + switch (true) { + case is_array($option): + $optionValue = isset($option['value']) ? $option['value'] : $optionValue; + $optionLabel = isset($option['label']) ? $option['label'] : ''; + break; + case $option instanceof \Magento\Framework\Phrase: + $optionLabel = $option; + break; + } + + $optionsByValue[$optionValue] = $optionLabel; } $values = explode(',', $value); foreach($values as $valueInstance) { $labels[] = isset($optionsByValue[$valueInstance]) - ? $optionsByValue[$valueInstance]['label'] : $valueInstance; + ? $optionsByValue[$valueInstance] : $valueInstance; } }