This module provides a simple Image Uploader for Widgets based on the Gist from @cedricblondeau.
composer require dlambauer/magento2-module-backend-widget-imageupload
To add an Image, you have to add a parameter like this in your widget.xml:
<parameter name="insert_a_meaningfull_name" xsi:type="block" required="true" visible="true" sort_order="10">
<label translate="true">Insert a Label here</label>
<description translate="true">Add a great Description</description>
<block class="Dlambauer\WidgetImageUpload\Block\Adminhtml\Widget\ImageChooser">
<data>
<item name="button" xsi:type="array">
<item name="open" xsi:type="string">Choose Image...</item>
</item>
</data>
</block>
</parameter>
- Add Unit and Integration Tests
- Require the JS Component more pretty, so we can remove the plain html script-tag from the block
- PHP >= 5.5.0
If you encounter any problems or bugs, please create an issue on GitHub.
Any contribution to the development of this Module is highly welcome. The best possibility to provide any code is to open a pull request on GitHub.
GNU General Public License, version 3 (GPLv3)
(c) 2015 David Lambauer