@@ -50,19 +50,7 @@ public function __construct(TemplateFactory $templateFactory, $fields = [])
50
50
*/
51
51
public function validate (DesignConfigInterface $ designConfig )
52
52
{
53
- /** @var DesignConfigDataInterface[] $designConfigData */
54
- $ designConfigData = $ designConfig ->getExtensionAttributes ()->getDesignConfigData ();
55
- $ elements = [];
56
- foreach ($ designConfigData as $ designElement ) {
57
- if (!in_array ($ designElement ->getFieldConfig ()['field ' ], $ this ->fields )) {
58
- continue ;
59
- }
60
- /* Save mapping between field names and config paths */
61
- $ elements [$ designElement ->getFieldConfig ()['field ' ]] = [
62
- 'config_path ' => $ designElement ->getPath (),
63
- 'value ' => $ designElement ->getValue ()
64
- ];
65
- }
53
+ $ elements = $ this ->getElements ($ designConfig );
66
54
67
55
foreach ($ elements as $ name => $ data ) {
68
56
$ templateId = $ data ['value ' ];
@@ -89,6 +77,30 @@ public function validate(DesignConfigInterface $designConfig)
89
77
}
90
78
}
91
79
80
+ /**
81
+ * Get elements from design configuration
82
+ *
83
+ * @param DesignConfigInterface $designConfig
84
+ * @return array
85
+ */
86
+ private function getElements (DesignConfigInterface $ designConfig )
87
+ {
88
+ /** @var DesignConfigDataInterface[] $designConfigData */
89
+ $ designConfigData = $ designConfig ->getExtensionAttributes ()->getDesignConfigData ();
90
+ $ elements = [];
91
+ foreach ($ designConfigData as $ designElement ) {
92
+ if (!in_array ($ designElement ->getFieldConfig ()['field ' ], $ this ->fields )) {
93
+ continue ;
94
+ }
95
+ /* Save mapping between field names and config paths */
96
+ $ elements [$ designElement ->getFieldConfig ()['field ' ]] = [
97
+ 'config_path ' => $ designElement ->getPath (),
98
+ 'value ' => $ designElement ->getValue ()
99
+ ];
100
+ }
101
+ return $ elements ;
102
+ }
103
+
92
104
/**
93
105
* Returns store identifier if is store scope
94
106
*
0 commit comments