1

Looking at the Magento 2 docs, you can override a base/core layout.xml file - http://devdocs.magento.com/guides/v2.0/frontend-dev-guide/layouts/layout-override.html

Is it possible, to overide within a module rather than theme?

Alternatively, is it possible to bundle a theme within a module and extend that (and multiple other themes from multiple other modules) from the main website theme?

2 Answers 2

-1

It is the same as with with theme layout but you have copy layout xml file in your layout directory.

Namespace/Moduelname/view/frontend/layout/catalog_product_view.xml
3
  • 1
    If I put the xml file in Namespace/Moduelname/view/frontend/layout/override/base/catalog_product_view.xml it does not override it. I can extend the layout by placing it in the path you suggested, but I am looking for an override NOT extend
    – minlare
    Jan 24, 2017 at 14:04
  • Won't that just extend the XML?
    – Ben Crook
    Feb 1, 2017 at 17:11
  • @BenCrook it's extend the layout Feb 2, 2017 at 4:31
-1

When load, Magento will load all the XML files which have same name and merge them. If you want to override, you have to remove all the element of core layout in you XML file.Use this:

<referenceContainer name="container-name" remove="true"/>//with container
<referenceBlock name="block-name" remove="true"/>//with block

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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