cancel
Showing results for 
Search instead for 
Did you mean: 

Override xml file in vendor directory

SOLVED

Override xml file in vendor directory

I have an extension that works greats, however I'm facing a problem with one of its xml file

 

the file is in:

vendor/the_vendor/the_module/view/frontend/layout/the_file.xml

and contains the following code:

 

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <!--for 1 column layout move logo back to default place-->
        <move element="logo" destination="header-wrapper"/>
    </body>
</page>

In fact, I prefer avoid adding this header.

So, I could simply commented the following:

      <!--  <move element="logo" destination="header-wrapper"/> -->

But that is not the right solution as the file is in the vendor.

 

For this reason I tried to create the following file in my Theme directory in order to override the file:

app/design/frontend/Theme_Vender/Theme_Name/Module_Name/layout/The_File_Name.xml

with the following code:

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <!--for 1 column layout move logo back to default place-->
        <remove element="logo" destination="header-wrapper"/>
    </body>
</page>

but nothing change

I give the write permission and execute the following:

rm  -rf var/view_preprocessed/
rm  -rf pub/static
bin/magento setup:upgrade
bin/magento setup:di:compile
bin/magento setup:static-content:deploy -f
bin/magento c:f
bin/magento c:c

but nothing change.

So, what is the right way to solve this issue ?

 

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Override xml file in vendor directory

Hi @achahinewiffa8 ,

 

If you want to remove the logo element from the page then your xml code should be like this:

<referenceBlock name="logo" remove="true" />

But if your requirement is to only stop the logo element position change and we need logo element. In that case,

Again write the same code in theme directory and move the logo in the required block

<move element="logo" destination="block-name"/>

 

Hope this helps you!

Problem Solved! Click Kudos & Accept as Solution!

View solution in original post

2 REPLIES 2

Re: Override xml file in vendor directory

Hi @achahinewiffa8 ,

 

If you want to remove the logo element from the page then your xml code should be like this:

<referenceBlock name="logo" remove="true" />

But if your requirement is to only stop the logo element position change and we need logo element. In that case,

Again write the same code in theme directory and move the logo in the required block

<move element="logo" destination="block-name"/>

 

Hope this helps you!

Problem Solved! Click Kudos & Accept as Solution!

Re: Override xml file in vendor directory

I used the first one:

<referenceBlock name="logo" remove="true" />

and it solved my issue.

 

Thank you @Nishu Jindal