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 />

If you want to see the results of the layout merging on your <strong>developer</strong> machine, do<br />

the following:<br />

• Navigate to \Magento\Framework\View\Result\Page<br />

• Locate the render() method.<br />

• After the $output = $this->renderPage(); method, add:<br />

• $output .= $this->getLayout()->getXmlString();<br />

Go to a page on the website and view source. The XML will be appended after the<br />

HTML tag.<br />

How do design areas influence merging?<br />

Layout XML instructions are first merged in the base area and then by the area that<br />

applies to the current request (<strong>frontend</strong> or adminhtml).<br />

Here is the order in which layout XML is merged:<br />

• Module base files loaded<br />

• Module area files loaded<br />

• Sorted according to their module priority (array index of module’s position in<br />

app/etc/config.php)<br />

• If their priorities are equal, they are sorted according to their<br />

alphabetical priority.<br />

• Theme files (from furthest ancestor to current theme)<br />

• Layout files loaded<br />

• Override files replaced<br />

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

39

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

Saved successfully!

Ooh no, something went wrong!