This module is to demonstrate the different fields available for Magento 2 widgets. The idea is to use this as a base or reference for creating your own widgets.
You can install manually by following these steps:
- Download the repo zip file and extract
- You should have a folder called 'magento2-widgets-master'. Rename this folder to 'Widgets'
- Under your Magento site folder create a new directory 'app/code/Alvis'
- Upload the module to this folder 'app/code/Alvis/Widgets'
php bin/magento module:enable Alvis_Widgets
You may also need to re-compile:
php bin/magento setup:upgrade
php bin/magento setup:di:compile
There is an example widget provided which has all the possible field types available. The available fields are listed below:
- Text field
- Text area field
- Select field (boolean)
- Select field (custom options)
- Select field (custom source)
- Depends on field (only shows depending on the value of another field)
- Category chooser
- Product chooser
- Static block chooser
- CMS page chooser
- Image chooser
- Conditions field
You can insert a widget through the Magento 2 admin area by adding it to the WYSIWYG editor when creating a page or static CMS block.