:::: MENU ::::
Posts tagged with: move

Magento 2 Move or remove block from layout

Today we talk about how to remove or move block. You can move block from one container to another but using the move handle. Same as you can remove any block with remove handle. First we will show the example how we remove the breadcrumbs block. Use the handle of referenceBlock and add the name reference you want to remove. You can check the layout files where the breadcrumbs block is define.

Remove:

Now we add example code in our default.xml or you want to remove for any specific page then add his layout file. Now you can remove breadcrumbs by simply adding this code.

<referenceBlock name="breadcrumbs" remove="true"/>

You can use this example to remove any block

Move:

For moving the block from one container to another. Just add element Name in my example i am moving the page.top block to store.menu.container. Now below is example code.

<move element="page.top" destination="store.menu.container" before="-" />

You can use this example to move any block

Author: Qaisar Satti
Category: Magento 2
Last Modified: December 15, 2017