Download the PHP package mage-os/module-advanced-widget without Composer
On this page you can find all versions of the php package mage-os/module-advanced-widget. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download mage-os/module-advanced-widget
More information about mage-os/module-advanced-widget
Files in mage-os/module-advanced-widget
Package module-advanced-widget
Short Description Advanced cms widget module
License MIT
Informations about the package module-advanced-widget
MageOS AdvancedWidget Module for Magento
Add configurable multi-row CMS Widgets with image picker component, product picker component, select fields and much more.
Overview
The AdvancedWidget module allows you to define multi-row CMS widgets. These features combined with MageOS_PageBuilderWidget module (that is explicit dependency) make finally possible to develop custom pagebuilder components with own preview and a large set of configurations. Complex pagebuilder ui components development is no more needed.
🚀 Features
1) This module let you specify Title separators inside widgets
2) This module let you specify multiple "repeatable" sections where you can specify unlimited rows inside widgets
2.1) Each item field can receive a dedicated tooltip
2.2) Each field is validated and ask to be required for compilation
2.3) Items can be sorted
2.4) You can specify whether a field is editable directly in the main box or whether it must be edited in the detail modal.
3) Row item images fields are available
4) Row item select fields are available
5) Row item product fields are available
6) Row item wysiwyg and colorpicker fields are also available (see the field reference below)
📖 Field reference
Two kinds of fields exist:
- Widget parameter fields — declared in your module's
etc/widget.xmlasxsi:type="block"parameters pointing at a renderer class fromMageOS\AdvancedWidget\Block\WidgetField\*. On the frontend the value arrives as plain block data ($block->getData('name')). - Repeatable row fields — declared in PHP inside a
Rowssubclass; editors can add, sort and delete unlimited rows, each row containing these fields.
Widget parameter fields
Image — Block\WidgetField\Image
Renders a text input with a "Choose Image..." button that opens the Magento media gallery browser. Stores the media-relative path (e.g. wysiwyg/hero/image.jpg) as a plain string.
On the frontend, resolve the stored path with $block->getImageUrl('image') (from Block\Widgets\AbstractColumns) — it prefixes the store media base URL when the value isn't already absolute.
TextArea — Block\WidgetField\TextArea
Plain multi-line text input (no HTML editor). Line breaks are preserved in the stored value.
WYSIWYG — Block\WidgetField\Wysiwyg
Full TinyMCE editor (variables and images enabled, nested widgets disabled). The stored value is HTML — don't escapeHtml it on the frontend; sanitize it instead, e.g. with Block\Widgets\Template::stripTags(), which ships with a sensible default tag whitelist.
Title separator — Block\WidgetField\Title
Purely visual: renders a heading/divider inside the widget form to group fields. It stores no meaningful value — the displayed text comes from the parameter's <description>. Don't read this parameter on the frontend.
Repeatable rows — Block\WidgetField\Rows
The headline feature: unlimited sortable rows, each with its own field set. The parameter name must start with repeatable_ — both the save plugin (Plugin\SaveRepeatableItems) and the admin renderer detect repeatable values by that prefix. A widget can have several repeatable parameters, each with its own Rows subclass.
Repeatable row fields
Extend MageOS\AdvancedWidget\Block\WidgetField\Rows and fill the $rows property — an ordered map of field_key => config:
Row config keys
| Key | Meaning |
|---|---|
label |
Admin label for the field |
type |
One of the row field types below |
required |
Adds admin-side validation on the row |
preview |
true → editable directly in the collapsed row list; false → only in the row's edit modal |
description |
Tooltip text next to the field |
options |
value => label map, select type only |
default |
Starting color for a colorpicker field, e.g. #FF0000 or rgba(0,0,0,1); falls back to #FFFFFF |
Row field types
| Type | Admin control | Stored value |
|---|---|---|
text |
Single-line text input | Plain string |
textarea |
Multi-line text input | Plain string, line breaks preserved |
select |
Dropdown built from the options map |
The selected option value |
image |
Media gallery browser button | Media-relative path (resolve with getImageUrlByPath()) |
product |
Product chooser grid | Product ID — see below |
wysiwyg |
TinyMCE editor in the row modal | HTML string (same escaping caveats as the WYSIWYG parameter) |
colorpicker |
JSColor picker (rgba format); starting color set via the row's default key |
CSS color string, e.g. rgba(255,255,255,1) |
Notes:
textandtextareaare built in;select,image,product,wysiwygandcolorpickerare registered as custom field types inetc/adminhtml/di.xml(thecustomFieldsargument ofBlock\Adminhtml\Renderer\Repeatable). Third-party modules can register additional types through the same DI argument — each entry pairs atypename with a JS component and a.phtmlpartial.product: the field key must start withproduct— the admin renderer then auto-populates the sibling display keys<field>_sku,<field>_nameand<field>_imagefor the row list. On the frontend, load the product from the stored ID;ViewModel\ProductData::getProductById()does this and pre-resolvesmageos_main_image,mageos_swatch_image,mageos_small_imageandmageos_thumb_imageURLs on the product.
Reading values on the frontend
Extend MageOS\AdvancedWidget\Block\Widgets\AbstractColumns in your widget block:
Available helpers:
| Method | Purpose |
|---|---|
getRepeatableField($name) |
Decoded array of row arrays for a repeatable parameter |
getRepeatableFieldAsObject($name) |
Same rows as DataObjects ($item->getTitle()) |
getImageUrl($field) / getImageUrlByPath($path) |
Resolve a stored media-relative path into a full media URL |
getPreparedUrl($url) |
Normalize relative link values against the store base URL |
getPreparedDescription($field) |
Replace \EOL markers with <br /> |
🔧 Installation
-
Install it into your Mage-OS/Magento 2 project with composer:
- Enable module
🤝 Changelog
Please see CHANGELOG for more information on what has changed recently.
📄 License
The MIT License (MIT). Please see License File for more information.
Attribution
This software uses Open Source software. See the ATTRIBUTION page for these projects.
All versions of module-advanced-widget with dependencies
magento/module-widget Version *
magento/module-page-builder Version ^2.0
mage-os/module-page-builder-widget Version *