0

I have a custom layout file mytheme/default/magento_theme/layout/custom_cms_name.xml

I need to override with a theme file from my custom module:

/companyname/modulename/frontend/layout/

I tested and "/companyname/modulename/frontend/layout/cms_page_view_id_idhere.xml" works so I know the module is working but /companyname/modulename/frontend/layout/custom_cms_name.xml does not work.

What naming convention can I use within my module to override custom layout form my theme ??

0

I think your path worng .You are missing view folder.For Example Check below

Your path is :-

/companyname/modulename/frontend/layout/custom_cms_name.xml

instand of :-

/companyname/modulename/view/frontend/layout/custom_cms_name.xml

And finally you test your xml file like this :-

<?xml version="1.0"?>
<page
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <referenceContainer name="content">
        <block class="Companyname\Modulename\Block\Post" name="brand.list" template="Companyname_Modulename::yourfilename.phtml"/>
    </referenceContainer>
</page>

And Then run Below commands :-

php bin/magento s:up
php bin/magento s:s:d -f
php bin/magento c:c
php bin/magento c:f

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.