cancel
Showing results for 
Search instead for 
Did you mean: 

Override core block in my custom theme

   Did you know you can see the translated content as per your choice?

Translation is in progress. Please check again after few minutes.

Override core block in my custom theme

Hello All,

 

I want to override core block file i.e, (vendor/magento/module-theme/Block/Html/Topmenu.php) for my custom theme.

 

Can anyone suggest me anything for this.

 

Thanks

 

Magento Developer
Ankita Biswas
2 REPLIES 2

Re: Override core block in my custom theme

Hello Ankita,

 

You can override core block in you theme like that:

vendor/theme/Magento_Theme/Block/Html/Topmenu.php
Magento 2 Professional Developer
https://nslayout.com/

Re: Override core block in my custom theme

HI @Ankita Biswas 

 

You can override core block using di,xml. 

for more info you can visit following link.

overriding-rewriting-classes-magento2/

 

I hope it will help you!