Creating a widget configuration file
In this recipe, we will extend the features of the Packt_ProductSlider module with a widget configuration file. In this configuration file, we will declare a new widget or frontend app type.
For a new frontend app, we need to configure the following things:
Name of the widget (used in the backend)
Widget configuration parameters
Widget block type
Widget templates (the
.phtmlfiles)
Getting ready
We will extend the module that we created in the previous recipe with a widget configuration. Ensure that you have the right files installed.
How to do it...
Using the following steps, you can explore the purpose of a widget.xml configuration file:
Create the
app/code/Packt/ProductSlider/etc/widget.xmlfile using the following code:<?xml version="1.0" encoding="UTF-8"?> <widgets xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Widget:etc/widget.xsd"> <widget id="category_product_slider...