Skip to content

Commit e7e4121

Browse files
MC-3481: Remove Anchor
- clean up renderer code
1 parent 6c879bb commit e7e4121

File tree

1 file changed

+7
-14
lines changed
  • app/code/Magento/PageBuilder/Setup/DataConverter/Renderer

1 file changed

+7
-14
lines changed

app/code/Magento/PageBuilder/Setup/DataConverter/Renderer/Anchor.php

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -45,32 +45,25 @@ public function render(array $itemData, array $additionalData = []) : string
4545
$eavData = $this->eavAttributeLoader->load($itemData['entityId']);
4646

4747
$rootElementAttributes = [
48-
'data-element' => 'main',
49-
'data-role' => 'html',
50-
'data-appearance' => 'default'
51-
];
52-
53-
$anchorElementAttributes = [
5448
'class' => $eavData['css_classes'] ?? '',
5549
'id' => $eavData['anchor_id']
5650
];
5751

5852
if (isset($itemData['formData'])) {
5953
$style = $this->styleExtractor->extractStyle($itemData['formData']);
6054
if ($style) {
61-
$anchorElementAttributes['style'] = $style;
55+
$rootElementAttributes['style'] = $style;
6256
}
6357
}
6458

65-
$rootElementHtml = '<div';
59+
$anchorHtml = '<div';
6660
foreach ($rootElementAttributes as $attributeName => $attributeValue) {
67-
$rootElementHtml .= $attributeValue ? " $attributeName=\"$attributeValue\"" : '';
61+
$anchorHtml .= $attributeValue ? " $attributeName=\"$attributeValue\"" : '';
6862
}
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>';
7467

7568
return $rootElementHtml;
7669
}

0 commit comments

Comments
 (0)