/Magento2-WidgetImageUpload

Simply add an image to your widget in Magento 2

Primary LanguagePHPGNU General Public License v3.0GPL-3.0

Magento2-Widget-ImageUpload

Introduction

This module provides a simple Image Uploader for Widgets based on the Gist from @cedricblondeau.

alt text

Installation

composer require dlambauer/magento2-module-backend-widget-imageupload

Add an Image

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>

ToDo

  • Add Unit and Integration Tests
  • Require the JS Component more pretty, so we can remove the plain html script-tag from the block

Requirements

  • PHP >= 5.5.0

Support

If you encounter any problems or bugs, please create an issue on GitHub.

Contribution

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.

Licence

GNU General Public License, version 3 (GPLv3)

Copyright

(c) 2015 David Lambauer