From 48560ad9a3b9d1ecd543313f52d03a68ce55b0a7 Mon Sep 17 00:00:00 2001 From: Yonn Trimoreau Date: Thu, 11 Jan 2018 11:27:37 +0100 Subject: [PATCH] Visual swatch images were not visible in backoffice $newSwatch was initialized as a string but it was used as an array in both the function body and in the calling function. This resulted in $newSwatch was always set to "b" (the first letter of "background"), and so the view did not get a correct style="background: url('xxxxx.xxx'); background-size: cover;" This issue is only visible for PHP 7 --- .../Block/Adminhtml/Attribute/Edit/Options/Visual.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/Swatches/Block/Adminhtml/Attribute/Edit/Options/Visual.php b/app/code/Magento/Swatches/Block/Adminhtml/Attribute/Edit/Options/Visual.php index 306f01af17e71..0e037dc08bb48 100644 --- a/app/code/Magento/Swatches/Block/Adminhtml/Attribute/Edit/Options/Visual.php +++ b/app/code/Magento/Swatches/Block/Adminhtml/Attribute/Edit/Options/Visual.php @@ -85,14 +85,14 @@ public function getJsonConfig() * * @codeCoverageIgnore * @param null $swatchStoreValue - * @return string + * @return array */ protected function reformatSwatchLabels($swatchStoreValue = null) { if ($swatchStoreValue === null) { return; } - $newSwatch = ''; + $newSwatch = []; foreach ($swatchStoreValue as $key => $value) { if ($value[0] == '#') { $newSwatch[$key] = 'background: '.$value;