0

i would like to extend my child theme layout xml file from my custom module. It my child theme path: app/design/frontend/Smartwave/porto_child/Smartwave_porto/layout/default.xml

    <referenceContainer name="page.wrapper">
        <block class="Smartwave\Porto\Block\Template" name="porto_header" template="html/header.phtml" before="main.content">
            <block class="Magento\Framework\View\Element\Html\Links" name="header.links">
                <arguments>
                    <argument name="css_class" xsi:type="string">header links</argument>
                </arguments>
            </block>
            <block class="Smartwave\Porto\Block\Form\Login" name="header_customer_form_login" ifconfig="porto_settings/header/login_popup" template="Smartwave_Porto::html/login.phtml"/>
            <block class="Magento\Store\Block\Switcher" name="store_language" as="store_language" template="switch/languages.phtml"/>
            <block class="Magento\Framework\View\Element\Template" name="top.search" as="topSearch" template="Magento_Search::form.mini.phtml" />
            <block class="Smartwave\Porto\Block\Template" name="custom_block" cacheable="false" template="html/header_custom_block.phtml" ifconfig="porto_settings/header/static_block" after="-"/>
        </block>
    </referenceContainer>

i added this my custom module etc/module.xml

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd">
    <module name="My_module" setup_version="1.0.0">
        <sequence>
            <module name="Smartwave_Porto"/>
            <module name="Magento_Catalog"/>
            <module name="Magento_CatalogSearch"/>
        </sequence>
    </module>
</config>

view/frontend/layout/default.xml

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceContainer name="page.wrapper">
            <block class="Smartwave\Porto\Block\Template" name="porto_header" template="html/header22.phtml" before="main.content">
                <block class="MyModule\Block\Mymodule" name="custommodule" cacheable="false" template="MyModule::mymod.phtml" after="-"/>
            </block>
        </referenceContainer>
    </body>
</page>

its still useing child theme default.xml, but i want to use my module layout.

Your Answer

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

Browse other questions tagged or ask your own question.