Is it possible to change a block type in layout XML?
I know how to change template using setTemplate
method, but I am trying to change a block's type. Is this possible?
blockslayoutmagento-1
Is it possible to change a block type in layout XML?
I know how to change template using setTemplate
method, but I am trying to change a block's type. Is this possible?
Best Answer
Changing the block type means changing the block class, so no, but...
... you can just overwrite the block:
layout.xml
is processed after the block is created, e.g. with<depends>
inCompany_Module.xml
The problem is, that this overwrites the block and does not change the type. This means everything which is done on this block between the creation and your change is lost.
For example for changing the
catalog.navigation
: