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: docs/configurations/content-type-configuration.md
+23-17Lines changed: 23 additions & 17 deletions
Original file line number
Diff line number
Diff line change
@@ -315,12 +315,12 @@ Set the `default` attribute to "true" in an `appearance` node to set the default
315
315
316
316
The name attribute in the element tags gets converted to a `data-element` attribute in the master format in order for readers to access the desired element.
317
317
318
-
### Attributes for `property` and `attribute`
318
+
### Attributes for `style`, `property` and `attribute`
|`name`| Unique name used for configuration merging, and the default value for storage_key if none is provided. |
323
-
|`storage_key`| Optional variable name for value in the data storage. If no value is provided, name will be used. |
323
+
|`storage_key`| Optional variable name for value in the data storage. If no value is provided, name will be used. This is the form fields data scope which is typically the name unless a `dataScope` is provided on the field. Supports the dot notation for `dataScope` (such as `layout.min_height`)|
324
324
|`source`| The name of the property or attribute in the DOM. Must be in snake case. |
325
325
|`converter`| Converts the value after reading or before saving to the DOM. |
326
326
|`preview_converter`| Converts the value for the preview. Used for cases where the conversion logic is different between the two views. |
@@ -398,12 +398,14 @@ The `fromDom` method is called after data is read from the master format.
398
398
399
399
The `toDom` method is called before observables are updated in the cycle rendering preview or master format.
400
400
401
+
When accessing data provided into the above functions **you should** utilise the `get` and `set` utility functions from `Magento_PageBuilder/js/utils/object` to ensure any data mapping entries which traverse deeper into the data set with the dot notation can correctly retrieve and set their data.
402
+
401
403
**Example:**
402
404
403
405
The following is a converter that determines the output for an overlay background color:
404
406
405
407
```js
406
-
define(["Magento_PageBuilder/js/utils/color-converter", "Magento_PageBuilder/js/utils/number-converter"], function (colorConverter, numberConverter) {
408
+
define(["Magento_PageBuilder/js/utils/color-converter", "Magento_PageBuilder/js/utils/number-converter", "Magento_PageBuilder/js/utils/object"], function (colorConverter, numberConverter, objectUtil) {
407
409
varOverlayBackgroundColor=function () {};
408
410
409
411
/**
@@ -444,6 +446,8 @@ The `fromDom` method is called after data is read for all elements and converted
444
446
445
447
The `toDom` method is called before data is converted by element converters to update observables.
446
448
449
+
When accessing data provided into the above functions **you should** utilise the `get` and `set` utility functions from `Magento_PageBuilder/js/utils/object` to ensure any data mapping entries which traverse deeper into the data set with the dot notation can correctly retrieve and set their data.
450
+
447
451
**Example:** Mass converter that defaults mobile image value to desktop image value if not configured
448
452
```xml
449
453
<converters>
@@ -457,7 +461,7 @@ The `toDom` method is called before data is converted by element converters to u
457
461
```
458
462
459
463
```js
460
-
define([], function () {
464
+
define(["Magento_PageBuilder/js/utils/object"], function (objectUtil) {
0 commit comments