How can do you change the class type and template of a block set by LayoutXML?
For instance I would like to change the class used below from Magento\Wishlist\Block\Customer\Wishlist
to Holy\Wishlist\Block\Customer\Wishlist
and the template to a template from my module.
<block class="Magento\Wishlist\Block\Customer\Wishlist" name="customer.wishlist" template="view.phtml" cacheable="false">
So far I've tried
<referenceBlock name="customer.wishlist">
<!--<block class="Holy\Wishlist\Block\Customer\Wishlist" template="Holy_Wishlist::view.phtml"/>-->
<arguments>
<argument name="class" xsi:type="string">Holy\Wishlist\Block\Customer\Wishlist</argument>
<argument name="template" xsi:type="string">Holy_Wishlist::view.phtml</argument>
</arguments>
</referenceBlock>
Best Answer
Quite old question, but might be useful for someone else, so you can use preference in module di.xml like
After this template can be change easily in layout xml without removing core block.