1

There is, in a theme that I bought a layout.xml file that is used in the backoffice to hydrat a select element (that allows you to switch between 5 layouts).

app/code/CompanyTheme/LayoutSwitcher/etc/layouts.xml

this file contains

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:CompanyTheme_LayoutSwitcher:etc/layouts.xsd">
    <layout id="header_layout_1" label="Header Layout 1" type="header" />
    <layout id="header_layout_2" label="Header Layout 2" type="header" />
    <layout id="header_layout_3" label="Header Layout 3" type="header" />
    <layout id="header_layout_4" label="Header Layout 4" type="header" />
    <layout id="header_layout_5" label="Header Layout 5" type="header" />
</config>

I want to add a sixth layout. For the moment I have modified this file directly to add a line (layout 6), but I know that this is not correct because the changes I made will disappear the next time I update the code that does not belong to me.

I searched but I don't know if it is possible to override this kind of file. If so, please give me some hints or on the contrary confirm that we can't...

0

If you have created a child theme, You can override the file by copying the file to below location

app/design/frontend/YourVendor/Module/CompanyTheme_LayoutSwitcher/layout/layouts.xml

and add a sixth layout or any customization you need

0

basically, you need to create a child theme, so if any update come then no effect on your theme.

and also use git so you can track the whole summary.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.