10
10
use Magento \Framework \Config \DataInterfaceFactory ;
11
11
use Magento \Ui \Config \Converter ;
12
12
13
+ /**
14
+ * Retrieve fields and default values from associated UI component forms for content types
15
+ */
13
16
class UiComponentConfig
14
17
{
15
18
/**
@@ -31,7 +34,7 @@ public function __construct(
31
34
/**
32
35
* Retrieve fields for UI Component
33
36
*
34
- * @param $componentName
37
+ * @param string $componentName
35
38
*
36
39
* @return array
37
40
*/
@@ -61,32 +64,11 @@ function ($item, $key) {
61
64
return $ fields ;
62
65
}
63
66
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
-
85
67
/**
86
68
* Iterate over components within the configuration and run a defined callback function
87
69
*
88
- * @param $config
89
- * @param $callback
70
+ * @param array $config
71
+ * @param \Closure $callback
90
72
* @param bool $key
91
73
*
92
74
* @return array
@@ -96,6 +78,10 @@ private function iterateComponents($config, $callback, $key = false) : array
96
78
$ values = $ callback ($ config , $ key ) ?: [];
97
79
if (isset ($ config [Converter::DATA_COMPONENTS_KEY ])
98
80
&& !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
+ )
99
85
) {
100
86
foreach ($ config [Converter::DATA_COMPONENTS_KEY ] as $ key => $ child ) {
101
87
$ values = array_merge (
0 commit comments