Developing a widget
The method of developing a widget does not differ much from that of developing a regular Magento module. In a few words, a Magento widget is a Magento module that generates admin add-ons, which you can easily insert into CMS pages or CMS blocks with simple actions.
We will start by creating a sample module that provides one simple widget.
The widget called Social Widget Icons outputs a block that includes the AddThis social sharing icons, the same sharing icons that we added in Chapter 6, Making the Theme Socially Ready.
The final frontend result is shown by the following screenshot:
Creating an empty module
Let's start by creating the module's directory structure and the main files. The module folder
must be located into app/code
.
Here, you have to decide in which code pool you want to create the module. Usually, you can create your module under the local code pool.
Tip
Never create a module inside the core folder of Magento and never edit the files inside the core. It can...