Using Magento Commerce 2.3.5-p2.
I'm changing the template of the layered navigation from a custom module like this:
<referenceBlock name="catalog.navigation.renderer"
template="Vendor_Module::layer/filter.phtml"/>
This works correctly.
I am displaying images for some filters, and I want to have them lazy-loaded with Magefan_Lazyload.
The module has a plugin in frontend/di.xml
:
<type name="Magento\Framework\View\Element\AbstractBlock">
<plugin name="magefan_lazyload_lock"
type="Magefan\LazyLoad\Plugin\BlockPlugin" sortOrder="1000"/>
</type>
In my opinion, this should work for all blocks that extend Magento\Framework\View\Element\AbstractBlock
, so for example for all Magento\Framework\View\Element\Template
blocks.
It works for some Template
-blocks, but it doesn't work for some other blocks, such as catalog.leftnav
, or the one I am changing above.
I also added debug code to Magento\Framework\View\Element\AbstractBlock::toHtml()
, and it seems that this method is never called for my block. Also, I don't think the toHtml()
method is overwritten somewhere.
Any tips?
I am running in developer mode. Strange enough, it works different in production mode - catalog.leftnav
is recognized, but still not catalog.navigation.renderer
.
I also tried changing the plugin's sortOrder
to 1, this didn't work either.