Download the PHP package mage-os/module-page-builder-widget without Composer
On this page you can find all versions of the php package mage-os/module-page-builder-widget. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download mage-os/module-page-builder-widget
More information about mage-os/module-page-builder-widget
Files in mage-os/module-page-builder-widget
Package module-page-builder-widget
Short Description PageBuilder cms widget module
License MIT
Informations about the package module-page-builder-widget
MageOS PageBuilder Widget Module for Magento
New page builder component named "CMS Widget".
🚀 Features
The PageBuilder Widget module allows the user to specify CMS widgets and relative configurations inside a dedicated page builder component named "CMS Widget". As for all pagebuilder components this component is draggable and can be placed inside other components.
If supported, the page builder will show widget content inside stage preview.
🔌 How it works
Widget Preview assignment
In order to create a widget preview you must create a new widget.xml file inside your module changing Magento_Widget xsd file inside "xsi:noNamespaceSchemaLocation" attribute of "widget" xml node. Literally change
with that:
Now you're able to specify new widget.xml nodes:
- previewTemplates
- previewCss
- previewJs
- previewBlock
- previewBlockArguments
previewTemplates XML node
This is where all starts :) inside this node you must specify each phtml preview file and his relation to the widget frontend phtml view. So, checking widget.xml inside this module:
As you know xml files are all merged so here we need to specify the widget id and then the previewTemplates node. The Magento_Widget widget.xml specify widget's parameters and, inside of them, a "template" parameter where multiple templates are specified:
For each of these options we need to copy the value inside "previewsTemplate" child "previewTemplate" node "name" attribute and our phtml preview file inside his content. So, specifying the template inside widget configurations pagebuilder will keep the relative phtml preview.
previewCss XML node
For every preview this module allow to specify a dedicated CSS file. Inside this file you can style your previews. Keep in mind that these files are included in each widget instance preview on pagebuilder. Be sure to use enough specific css selectors avoiding conflicts with other components.
ATTENTION: Remember to place this php snippet inside your phtml preview file for css inclusion:
previewJs XML node
For every preview this module allow to specify a dedicated Js file. Inside this file you can add js actions and triggers to the preview. Remember that mouse actions are not triggered on widgets preview elements so this JS is useful for animations only (ex: sliders scroll, ... )
previewBlock XML node
Sometimes you'll need to substitute the main Block class behind the preview choosing it instead of widget model inside "class" attribute. You can specify this new PHP class in this node and it will be used replacing the original widget class:
ATTENTION: Remember to place this php snippet inside your phtml preview file for js inclusion:
previewBlockArguments XML node
As for previewBlock sometimes widget previews need to have specific methods for content retrieval and other stuff. So, instead of specifying a new previewBlock node you can add a previewBlockArguments node. Similar to view model pattern (but no need to implement ArgumentInterface there) you can specify an object that will be initialized for your preview:
Then call his public methods inside your phtml preview:
🔧 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.
All versions of module-page-builder-widget with dependencies
magento/module-widget Version *
magento/module-page-builder Version ^2.0