Skip to content

Commit 5b3d232

Browse files
MAGETWO-52343: 404 when trying to display product view page (product.info.main container label is missing) #4234
1 parent f01f524 commit 5b3d232

File tree

2 files changed

+29
-6
lines changed

2 files changed

+29
-6
lines changed

lib/internal/Magento/Framework/View/Layout/Generator/Container.php

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,15 @@ public function generateContainer(
8484
$elementName,
8585
$options
8686
) {
87-
$structure->setAttribute(
88-
$elementName,
89-
Layout\Element::CONTAINER_OPT_LABEL,
90-
$options[Layout\Element::CONTAINER_OPT_LABEL]
91-
);
92-
unset($options[Layout\Element::CONTAINER_OPT_LABEL]);
87+
if (isset($options[Layout\Element::CONTAINER_OPT_LABEL])) {
88+
$structure->setAttribute(
89+
$elementName,
90+
Layout\Element::CONTAINER_OPT_LABEL,
91+
$options[Layout\Element::CONTAINER_OPT_LABEL]
92+
);
93+
unset($options[Layout\Element::CONTAINER_OPT_LABEL]);
94+
}
95+
9396
unset($options['type']);
9497

9598
$this->validateOptions($options);

lib/internal/Magento/Framework/View/Test/Unit/Layout/Generator/ContainerTest.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,26 @@ public function processDataProvider()
116116
['first_container', Container::CONTAINER_OPT_HTML_ID, 'dd_id'],
117117
],
118118
'setAttributeCalls' => 4,
119+
],
120+
'sample_data2' => [
121+
'structureElements' => [
122+
'first_container' => [
123+
'container',
124+
[
125+
'attributes' => [
126+
Container::CONTAINER_OPT_HTML_TAG => 'dd',
127+
Container::CONTAINER_OPT_HTML_CLASS => 'dd_class',
128+
Container::CONTAINER_OPT_HTML_ID => 'dd_id',
129+
]
130+
],
131+
],
132+
],
133+
'setAttributeData' => [
134+
['first_container', Container::CONTAINER_OPT_HTML_TAG, 'dd'],
135+
['first_container', Container::CONTAINER_OPT_HTML_CLASS, 'dd_class'],
136+
['first_container', Container::CONTAINER_OPT_HTML_ID, 'dd_id'],
137+
],
138+
'setAttributeCalls' => 3,
119139
]
120140
];
121141
}

0 commit comments

Comments
 (0)