I am trying to override view.xsd using Plugin and it's working on magento 2.1.x and 2.2.x but not working in 2.3.1.
I Add Same code To describe Here.
Extending the complexType named "imageType" with a custom image type
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It only takes a minute to sign up.
Sign up to join this communityI am trying to override view.xsd using Plugin and it's working on magento 2.1.x and 2.2.x but not working in 2.3.1.
I Add Same code To describe Here.
Extending the complexType named "imageType" with a custom image type
Try this, you can extend using preference
Add di.xml in the below folder
app/code/Vendor/ModuleName/etc/di.xml
then add the below code to it
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<preference for="Magento\Framework\Config\SchemaLocator" type="Vendor\ModuleName\Config\SchemaLocator" />
</config>
then add SchemaLocator.php in the below path
app/code/Vendor/ModuleName/Config/SchemaLocator.php
then add the below code to it
<?php
namespace Vendor\ModuleName\Config;
use Magento\Framework\Module\Dir;
class SchemaLocator extends \Magento\Framework\Config\SchemaLocator implements \Magento\Framework\Config\SchemaLocatorInterface
{
protected $schema = null;
/**
* @param \Magento\Framework\Module\Dir\Reader $moduleReader
*/
public function getSchema()
{
$result = sprintf(realpath(__DIR__ . '/../etc/view.xsd'));
return $result;
}
/**
* {@inheritdoc}
*/
public function getPerFileSchema()
{
return $this->_schema;
}
}
the above code will change the path of view.xsd to your custom module from core.
Finally, add the view.xsd in the below path
app/code/Vendor/ModuleName/etc/view.xsd
then you can add you changes there.
NOTE : This is working example in M2.3 and in previous version used plugin instead of preference