Problem
There is properly working custom module (as far as I'm concerned), that outputs map. I need to display it only at main page at the content
container.
Now it outputs at every page content
container.
What was done
First of all, I supposed, that it is doing by changing extended layout in the theme.
- At:
/app/design/frontend/<vendor>/<name>/Magento_Theme/layout/default.xml
was written:
<?xml version="1.0"?>
<!--
/**
* Copyright © 2016 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceContainer name="content">
<block class="<Vendor>\Map\Block\Map" name="map" template="<Vendor>_Map::map.phtml">
</block>
</referenceContainer>
</body>
</page>
I saw, that I can control displaying by changing the name, so i tried to use quite a lot of options, that PhpStorm gave me (especially with *.main.*
).
- The second option was to create custom
container
andmove
it, but in process I realised, that I can't selectdestination
at the particular page.
Best Answer
The problem was in incomplete understanding of Magento2 layout system.
Found an answer at:
Magento 2 - Custom Page Layout