Skip to content

Commit 50830d9

Browse files
committed
MC-3151: Update data migration
- Refactor row renderer to default to contained
1 parent fec7a8e commit 50830d9

File tree

1 file changed

+16
-20
lines changed
  • app/code/Magento/PageBuilder/Setup/DataConverter/Renderer

1 file changed

+16
-20
lines changed

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

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,13 @@ public function __construct(StyleExtractorInterface $styleExtractor)
3131
public function render(array $itemData, array $additionalData = []) : string
3232
{
3333
$formData = $itemData['formData'] ?? [];
34-
$appearance = (isset($formData['template'])
35-
&& $formData['template'] === 'full-width.phtml') ? 'full-width' : 'contained';
3634

3735
$style = $this->styleExtractor->extractStyle($formData);
3836

3937
$childrenHtml = (isset($additionalData['children']) ? $additionalData['children'] : '');
4038

41-
if ($appearance === 'full-width') {
39+
// Return an altered appearance for full width
40+
if (isset($formData['template']) && $formData['template'] === 'full-width.phtml') {
4241
return $this->renderElementWithAttributes(
4342
[
4443
'data-element' => 'main',
@@ -57,25 +56,22 @@ public function render(array $itemData, array $additionalData = []) : string
5756
);
5857
}
5958

60-
if ($appearance === 'contained') {
61-
return $this->renderElementWithAttributes(
59+
// All other rows default to our new default of contained
60+
return $this->renderElementWithAttributes(
61+
[
62+
'data-element' => 'main',
63+
'data-role' => 'row',
64+
'data-appearance' => 'contained',
65+
],
66+
$this->renderElementWithAttributes(
6267
[
63-
'data-element' => 'main',
64-
'data-role' => 'row',
65-
'data-appearance' => 'contained',
68+
'data-element' => 'inner',
69+
'class' => $itemData['formData']['css_classes'] ?? '',
70+
'style' => $style ?? null
6671
],
67-
$this->renderElementWithAttributes(
68-
[
69-
'data-element' => 'inner',
70-
'class' => $itemData['formData']['css_classes'] ?? '',
71-
'style' => $style ?? null
72-
],
73-
$childrenHtml
74-
)
75-
);
76-
}
77-
78-
return '';
72+
$childrenHtml
73+
)
74+
);
7975
}
8076

8177
/**

0 commit comments

Comments
 (0)