-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
Magento 2 Development Cookbook
By :
In the previous recipe, you learned how to configure an extra widget type to Magento. Now, it is time to display the widget.
We will extend the widget configuration with the option to select two different templates to render the widget in the frontend.
The second thing that we will do is create a custom Block class where we can write our own specific methods for the widget.
We will work further on the widget module that we created in the previous recipes. Ensure that you have the right code installed.
Using the following steps, you will learn how we can configure a custom Block class with custom templates for a widget instance:
The first thing that we will do is create the Block class for the widget. The Block class will extend Magento\Catalog\Block\Product\List class because we need the functionality of that class in our widget type. Create a file called ProductSlider.php in the app/code/Packt/ProductSlider/Block/Catalog/Product...
Change the font size
Change margin width
Change background colour