Skip to content

Commit 084c0ad

Browse files
committed
Merge remote-tracking branch 'remotes/origin/MC-5232-prefix-field-names' into cms-team-1-delivery
2 parents 56d02f9 + 6e516e4 commit 084c0ad

File tree

111 files changed

+1127
-338
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

111 files changed

+1127
-338
lines changed

app/code/Magento/PageBuilder/Model/Stage/Config/UiComponentConfig.php

Lines changed: 32 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,21 +49,44 @@ public function getFields($componentName) : array
4949
function ($item, $key) {
5050
// Determine if this item has a formElement key
5151
if (isset($item[Converter::DATA_ARGUMENTS_KEY]['data']['config']['formElement'])) {
52-
$elementConfig
53-
= $item[Converter::DATA_ARGUMENTS_KEY]['data']['config'];
54-
return [
55-
$key => [
56-
'default' => (isset($elementConfig['default'])
57-
? $elementConfig['default'] : '')
58-
]
59-
];
52+
$elementConfig = $item[Converter::DATA_ARGUMENTS_KEY]['data']['config'];
53+
// If the field has a dataScope use that for the key instead of the name
54+
if (isset($elementConfig['dataScope'])) {
55+
$key = $elementConfig['dataScope'];
56+
}
57+
$field = [];
58+
// Generate our nested field array with defaults supporting dot notation within the key
59+
$this->generateFieldArray(
60+
$field,
61+
$key . ".default",
62+
(isset($elementConfig['default']) ? $elementConfig['default'] : '')
63+
);
64+
return $field;
6065
}
6166
}
6267
);
6368

6469
return $fields;
6570
}
6671

72+
/**
73+
* Recursively generate our field array, allowing for dot notation within the key
74+
*
75+
* @param array $array
76+
* @param string $path
77+
* @param string|array $value
78+
*/
79+
private function generateFieldArray(array &$array, string $path, $value)
80+
{
81+
$keys = explode(".", $path);
82+
83+
foreach ($keys as $key) {
84+
$array = &$array[$key];
85+
}
86+
87+
$array = $value;
88+
}
89+
6790
/**
6891
* Iterate over components within the configuration and run a defined callback function
6992
*
@@ -84,7 +107,7 @@ private function iterateComponents($config, $callback, $key = false) : array
84107
)
85108
) {
86109
foreach ($config[Converter::DATA_COMPONENTS_KEY] as $key => $child) {
87-
$values = array_merge(
110+
$values = array_merge_recursive(
88111
$values,
89112
$this->iterateComponents($child, $callback, $key) ?: []
90113
);

app/code/Magento/PageBuilder/view/adminhtml/requirejs-config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ var config = {
1010
'pagebuilder/ko-dropzone': 'Magento_PageBuilder/js/resource/dropzone/knockout-dropzone',
1111

1212
/* Utilities */
13-
'google-map': 'Magento_PageBuilder/js/utils/map'
13+
'google-map': 'Magento_PageBuilder/js/utils/map',
14+
'object-path': 'Magento_PageBuilder/js/resource/object-path'
1415
}
1516
},
1617
shim: {

app/code/Magento/PageBuilder/view/adminhtml/web/js/content-type-factory.js

Lines changed: 19 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/code/Magento/PageBuilder/view/adminhtml/web/js/content-type-menu/edit.js

Lines changed: 21 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/code/Magento/PageBuilder/view/adminhtml/web/js/content-type/banner/converter/style/overlay-background-color.js

Lines changed: 5 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/code/Magento/PageBuilder/view/adminhtml/web/js/content-type/banner/preview.js

Lines changed: 2 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/code/Magento/PageBuilder/view/adminhtml/web/js/content-type/block/mass-converter/widget-directive.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/code/Magento/PageBuilder/view/adminhtml/web/js/content-type/block/preview.js

Lines changed: 7 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/code/Magento/PageBuilder/view/adminhtml/web/js/content-type/button-item/converter/style/display.js

Lines changed: 4 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/code/Magento/PageBuilder/view/adminhtml/web/js/content-type/buttons/converter/style/display/flex.js

Lines changed: 4 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)