Skip to content

Commit 3f64598

Browse files
committed
Merge branch 'MC-5231-disable-defaults-dynamic-rows' of github.com:magento-obsessive-owls/magento2-page-builder into cms-team-1-delivery
2 parents 14c9640 + f286692 commit 3f64598

File tree

1 file changed

+10
-24
lines changed

1 file changed

+10
-24
lines changed

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

Lines changed: 10 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
use Magento\Framework\Config\DataInterfaceFactory;
1111
use Magento\Ui\Config\Converter;
1212

13+
/**
14+
* Retrieve fields and default values from associated UI component forms for content types
15+
*/
1316
class UiComponentConfig
1417
{
1518
/**
@@ -31,7 +34,7 @@ public function __construct(
3134
/**
3235
* Retrieve fields for UI Component
3336
*
34-
* @param $componentName
37+
* @param string $componentName
3538
*
3639
* @return array
3740
*/
@@ -61,32 +64,11 @@ function ($item, $key) {
6164
return $fields;
6265
}
6366

64-
/**
65-
* Retrieve buttons associated with a UI component
66-
*
67-
* @param $componentName
68-
*
69-
* @return array
70-
*/
71-
public function getButtons($componentName) : array
72-
{
73-
$componentConfig = $this->configFactory->create(
74-
['componentName' => $componentName]
75-
)->get($componentName);
76-
77-
// Does the component have any buttons assigned?
78-
if (isset($componentConfig[Converter::DATA_ARGUMENTS_KEY]['data']['buttons'])) {
79-
return $componentConfig[Converter::DATA_ARGUMENTS_KEY]['data']['buttons'];
80-
}
81-
82-
return [];
83-
}
84-
8567
/**
8668
* Iterate over components within the configuration and run a defined callback function
8769
*
88-
* @param $config
89-
* @param $callback
70+
* @param array $config
71+
* @param \Closure $callback
9072
* @param bool $key
9173
*
9274
* @return array
@@ -96,6 +78,10 @@ private function iterateComponents($config, $callback, $key = false) : array
9678
$values = $callback($config, $key) ?: [];
9779
if (isset($config[Converter::DATA_COMPONENTS_KEY])
9880
&& !empty($config[Converter::DATA_COMPONENTS_KEY])
81+
&& (!isset($config[Converter::DATA_ARGUMENTS_KEY]['data']['config']['componentType'])
82+
|| isset($config[Converter::DATA_ARGUMENTS_KEY]['data']['config']['componentType'])
83+
&& $config[Converter::DATA_ARGUMENTS_KEY]['data']['config']['componentType'] !== 'dynamicRows'
84+
)
9985
) {
10086
foreach ($config[Converter::DATA_COMPONENTS_KEY] as $key => $child) {
10187
$values = array_merge(

0 commit comments

Comments
 (0)