Skip to content

Commit 9cca919

Browse files
author
Stanislav Idolov
authored
ENGCOM-2852: [Forwardport] #12250: View.xml is inheriting image sizes from paren… #17725
2 parents 6055de6 + 94dfc6e commit 9cca919

File tree

2 files changed

+16
-12
lines changed

2 files changed

+16
-12
lines changed

app/code/Magento/Catalog/Model/ImageExtractor.php

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,16 @@ public function process(\DOMElement $mediaNode, $mediaParentTag)
3232
continue;
3333
}
3434
$attributeTagName = $attribute->tagName;
35-
if ($attributeTagName === 'background') {
36-
$nodeValue = $this->processImageBackground($attribute->nodeValue);
37-
} elseif ($attributeTagName === 'width' || $attributeTagName === 'height') {
38-
$nodeValue = intval($attribute->nodeValue);
35+
if ((bool)$attribute->getAttribute('xsi:nil') !== true) {
36+
if ($attributeTagName === 'background') {
37+
$nodeValue = $this->processImageBackground($attribute->nodeValue);
38+
} elseif ($attributeTagName === 'width' || $attributeTagName === 'height') {
39+
$nodeValue = intval($attribute->nodeValue);
40+
} else {
41+
$nodeValue = $attribute->nodeValue;
42+
}
3943
} else {
40-
$nodeValue = !in_array($attribute->nodeValue, ['false', '0']);
44+
$nodeValue = null;
4145
}
4246
$result[$mediaParentTag][$moduleNameImage][Image::MEDIA_TYPE_CONFIG_NODE][$imageId][$attribute->tagName]
4347
= $nodeValue;

lib/internal/Magento/Framework/Config/etc/view.xsd

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,13 @@
4949
<xs:element name="image" minOccurs="1" maxOccurs="unbounded">
5050
<xs:complexType>
5151
<xs:sequence>
52-
<xs:element name="width" type="xs:positiveInteger" minOccurs="0"/>
53-
<xs:element name="height" type="xs:positiveInteger" minOccurs="0"/>
54-
<xs:element name="constrain" type="xs:boolean" minOccurs="0"/>
55-
<xs:element name="aspect_ratio" type="xs:boolean" minOccurs="0"/>
56-
<xs:element name="frame" type="xs:boolean" minOccurs="0"/>
57-
<xs:element name="transparency" type="xs:boolean" minOccurs="0"/>
58-
<xs:element name="background" minOccurs="0">
52+
<xs:element name="width" type="xs:positiveInteger" minOccurs="0" nillable="true"/>
53+
<xs:element name="height" type="xs:positiveInteger" minOccurs="0" nillable="true"/>
54+
<xs:element name="constrain" type="xs:boolean" minOccurs="0" nillable="true"/>
55+
<xs:element name="aspect_ratio" type="xs:boolean" minOccurs="0" nillable="true"/>
56+
<xs:element name="frame" type="xs:boolean" minOccurs="0" nillable="true"/>
57+
<xs:element name="transparency" type="xs:boolean" minOccurs="0" nillable="true"/>
58+
<xs:element name="background" minOccurs="0" nillable="true">
5959
<xs:simpleType>
6060
<xs:restriction base="xs:string">
6161
<xs:pattern value="\[(\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\]"/>

0 commit comments

Comments
 (0)