magento2重写virtualType而且传参

今天遇到一个需求须要重写一个block,可是这个block是应用virtualType实现,因此须要先重写virtualType,而后却由于参数丢失而获取不到正确的结果。所以,查阅文档,须要用type标签进行传参:spa

di.xmlcode

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <preference for="Magento\LayeredNavigationStaging\Block\Navigation\Search" type="Silk\CatalogPopup\Block\Search" />
    <type name="Silk\CatalogPopup\Block\Search">
        <arguments>
            <argument name="filterList" xsi:type="object">searchFilterList</argument>
        </arguments>
    </type>
</config>
相关文章
相关标签/搜索