mons / magento-widget
Magento 2 页面构建中有用的小部件参数类型
1.0.0
2023-01-08 14:47 UTC
Requires
- php: ~8.1.0
- magento/framework: 103.0.*
- magento/module-cms: 104.0.*
- magento/module-widget: 101.2.*
This package is auto-updated.
Last update: 2024-09-08 19:16:35 UTC
README
为 Magento 2 新增参数类型,以改善小部件定义体验。
参数类型
- 图片选择器字段
- 文本区域字段
- 所见即所得字段
- 可重复字段(进行中)
安装
- 使用 composer 安装模块
composer require mons/module-m2-widget
- 注册模块
php bin/magento setup:upgrade
使用示例
图片选择器
<parameter xsi:type="block" name="background_image" visible="true" sort_order="10"> <label translate="true">Background Image</label> <block class="Mons\Widget\Block\Adminhtml\Widget\Type\ImageChooser"> <data> <item name="button" xsi:type="array"> <item name="open" xsi:type="string">Choose Image...</item> </item> </data> </block> </parameter>
文本区域
<parameter xsi:type="block" name="body_text" visible="true" sort_order="10"> <label translate="true">Body Text</label> <block class="Mons\Widget\Block\Adminhtml\Widget\Type\Textarea" /> </parameter>
所见即所得
<parameter xsi:type="block" name="body_text" visible="true" sort_order="10"> <label translate="true">Body Text</label> <block class="Mons\Widget\Block\Adminhtml\Widget\Type\Wysiwyg"> <!-- optional TinyMCE config --> <data> <item name="toolbar" xsi:type="string">bold italic underline</item> <item name="plugins" xsi:type="string">link</item> </data> </block> </parameter>
已测试与以下软件兼容
- Magento 2.4
- PHP 8.1
贡献
- 分支此仓库
- 创建您的功能分支(
git checkout -b feature/your-new-feature
)或错误修复分支(git checkout -b bugfix/bug-short-description
) 总是 从develop
开始 - 提交并提交新的拉取请求