You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: app/code/Magento/PageBuilder/docs/visual-select.md
+19-7Lines changed: 19 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -69,12 +69,12 @@ To add Visual Select customization to a Page Builder content block:
69
69
70
70
## Override the select component with an element template {#element-template}
71
71
72
-
We use the default select component in the `/app/code/Magento/PageBuilder/view/adminhtml/ui-component/pagebuilder_base_form.xml` file. You can override the default template, specifying an element template for this functionality, to implement the Visual Select option.
72
+
We use the default select component in the `/app/code/Magento/PageBuilder/view/adminhtml/ui-component/pagebuilder_base_form.xml` file. You can override the default template, specifying an element template & component for this functionality, to implement the Visual Select option.
73
73
74
-
In the provided template, specify `<elementTmpl>`:
74
+
In the provided template, specify `<elementTmpl>` alongside updating the fields component to `Magento_PageBuilder/js/form/element/visual-select`:
@@ -84,23 +84,24 @@ In the provided template, specify `<elementTmpl>`:
84
84
85
85
## Add Visual Select to the XML config {#xml-config}
86
86
87
-
The available options for select, `value`, `title`, and `icon`, can be provided by the PHP class that implements the `\Magento\Framework\Option\ArrayInterface` method.
87
+
The available options for select, `value`, `title`, `icon`and `noticeMessage`, can be provided by the PHP class that implements the `\Magento\Framework\Option\ArrayInterface` method.
88
88
89
89
Options should return an array with the following format:
90
90
91
91
```php
92
92
[
93
93
value => "value", //key used in the component dataSource
94
94
title => "Title",
95
-
icon => "path/to/picture/on/server"
95
+
icon => "path/to/picture/on/server",
96
+
noticeMessage => "A message to be displayed when option is selected"
96
97
]
97
98
```
98
99
99
100
These new configuration values are used in the `align.html` template file stored in Page Builder's `app/code/Magento/Pagebuilder/view/adminhtml/web/template/form/element` directory.
100
101
101
102
Use a virtual type of `Magento\PageBuilder\Model\Source\VisualSelect` in your module's `di.xml` configuration file to define the options in a visual select field.
@@ -129,6 +130,17 @@ Use a virtual type of `Magento\PageBuilder\Model\Source\VisualSelect` in your mo
129
130
</virtualType>
130
131
```
131
132
133
+
### Display notice when option is selected
134
+
For some options you may wish to display an additional notice when the user selects the item. You can do this by providing a `noticeMessage` within the items declaration.
<itemname="noticeMessage"xsi:type="string"translate="true">Message to be displayed below field when selected.</item>
141
+
</item>
142
+
```
143
+
132
144
## How to reuse vertical alignment between different content types {#vertical-alignment}
133
145
To apply vertical alignment to a content type using the Visual Select component, use the virtualType `Magento\PageBuilder\Model\Source\VerticalAlignment` with options in your module's `di.xml` configuration file.
134
146
@@ -158,7 +170,7 @@ To apply vertical alignment to a content type using the Visual Select component,
158
170
```
159
171
### Add the Visual Select option in your module's form configuration file.
0 commit comments