Hi All,
In vendor/magento/framework/Config/etc/view.xsd there is part
<xs:attribute name="type"> <xs:simpleType> <xs:restriction base="xs:string"> <xs:enumeration value="thumbnail"/> <xs:enumeration value="small_image"/> <xs:enumeration value="image"/> <xs:enumeration value="swatch_image"/> <xs:enumeration value="swatch_thumb"/> </xs:restriction> </xs:simpleType> </xs:attribute>
I would like to add additional
<xs:enumeration value="hover_image"/>
Is it even possible in magento 2 ?
I tried to create custom xsd file like below and included in etc/view.xml file in "xsi:noNamespaceSchemaLocation", but I got error below.
Invalid XML in file .../etc/view.xml: Element 'image', attribute 'type': [facet 'enumeration'] The value 'hover_image' is not an element of the set {'thumbnail', 'small_image', 'image', 'swatch_image', 'swatch_thumb'}. Line: 21 Element 'image', attribute 'type': 'hover_image' is not a valid value of the local atomic type. Line: 21
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:redefine schemaLocation="urn:magento:framework:Config/etc/view.xsd">
<xs:complexType name="imageType">
<xs:sequence>
<xs:element name="image" minOccurs="1" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="width" type="xs:positiveInteger" minOccurs="0"/>
<xs:element name="height" type="xs:positiveInteger" minOccurs="0"/>
<xs:element name="constrain" type="xs:boolean" minOccurs="0"/>
<xs:element name="aspect_ratio" type="xs:boolean" minOccurs="0"/>
<xs:element name="frame" type="xs:boolean" minOccurs="0"/>
<xs:element name="transparency" type="xs:boolean" minOccurs="0"/>
<xs:element name="background" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:pattern value="\[(\d{1,3}),\s*(\d{1,3}),\s*(\d{1,3})\]"/>
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:sequence>
<xs:attribute name="id" type="xs:string" use="required"/>
<xs:attribute name="type">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:enumeration value="thumbnail"/>
<xs:enumeration value="small_image"/>
<xs:enumeration value="image"/>
<xs:enumeration value="swatch_image"/>
<xs:enumeration value="swatch_thumb"/>
<xs:enumeration value="hover_image"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="module" type="xs:string" use="required"/>
</xs:complexType>
</xs:redefine>
</xs:schema>
Practically the same here http://magento.stackexchange.com/questions/102498/extending-the-complextype-named-imagetype-with-a-c...
But without accepted answer.
This "Did you try changing module="Magento_Catalog" to module="Esites_SEO" ? " did not help for me.
Anyone figured this one out? It's crazy that this isn't seemingly possible without creating a plugin that overwrites the core XSD..
Is there already a solution for this?