@@ -45,32 +45,25 @@ public function render(array $itemData, array $additionalData = []) : string
45
45
$ eavData = $ this ->eavAttributeLoader ->load ($ itemData ['entityId ' ]);
46
46
47
47
$ rootElementAttributes = [
48
- 'data-element ' => 'main ' ,
49
- 'data-role ' => 'html ' ,
50
- 'data-appearance ' => 'default '
51
- ];
52
-
53
- $ anchorElementAttributes = [
54
48
'class ' => $ eavData ['css_classes ' ] ?? '' ,
55
49
'id ' => $ eavData ['anchor_id ' ]
56
50
];
57
51
58
52
if (isset ($ itemData ['formData ' ])) {
59
53
$ style = $ this ->styleExtractor ->extractStyle ($ itemData ['formData ' ]);
60
54
if ($ style ) {
61
- $ anchorElementAttributes ['style ' ] = $ style ;
55
+ $ rootElementAttributes ['style ' ] = $ style ;
62
56
}
63
57
}
64
58
65
- $ rootElementHtml = '<div ' ;
59
+ $ anchorHtml = '<div ' ;
66
60
foreach ($ rootElementAttributes as $ attributeName => $ attributeValue ) {
67
- $ rootElementHtml .= $ attributeValue ? " $ attributeName= \"$ attributeValue \"" : '' ;
61
+ $ anchorHtml .= $ attributeValue ? " $ attributeName= \"$ attributeValue \"" : '' ;
68
62
}
69
- $ rootElementHtml .= '><div ' ;
70
- foreach ($ anchorElementAttributes as $ attributeName => $ attributeValue ) {
71
- $ rootElementHtml .= $ attributeValue ? " $ attributeName= \"$ attributeValue \"" : '' ;
72
- }
73
- $ rootElementHtml .= '></div></div> ' ;
63
+ $ anchorHtml .= '></div> ' ;
64
+
65
+ $ rootElementHtml = '<div data-element="main" data-role="html" data-appearance="default"> ' ;
66
+ $ rootElementHtml .= $ anchorHtml . '</div> ' ;
74
67
75
68
return $ rootElementHtml ;
76
69
}
0 commit comments