04.07.2019 Views

frontend-developer-1

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Layout XML in Themes<br />

How can the order of rendered child blocks be influenced both in<br />

containers and in blocks?<br />

The order is influenced through the use of the before and after attributes. You<br />

can specify a block or container’s name or you can use the - (dash) symbol to<br />

denote at the beginning or the end.<br />

HELPFUL LINKS:<br />

• https://devdocs.magento.com/guides/v2.2/<strong>frontend</strong>-dev-guide/<br />

layouts/xml-instructions.html<br />

3.5 DESCRIBE LAYOUT XML OVERRIDE<br />

TECHNIQUE<br />

How can layout XML be overridden?<br />

It is not ideal to override layout. However, as described by this article, there are<br />

some situations where overriding XML layout is inevitable.<br />

For example, to completely erase the existing Magento product page layout in<br />

our SwiftOtter Flex theme, you would create a new XML file in: app/design/<br />

SwiftOtter/Flex/Magento_Catalog/layout/override/<strong>frontend</strong>/<br />

catalog_product_view.xml.<br />

Note that these files are placed into the override folder instead of directly<br />

inside the layout folder. XML files that are directly placed in the layout directory<br />

are merged, while XML files that are placed in the appropriate subdirectory of<br />

override replace the original file.<br />

Copyright © 2018, SwiftOtter, Inc.<br />

36

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!