今天遇到一個需求須要重寫一個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>