Skip to content

Commit c188002

Browse files
authored
ENGCOM-7038: Add Header (h1 - h6) tags to layout xml htmlTags Allowed types #23742
2 parents 39914f7 + 5913b79 commit c188002

File tree

3 files changed

+26
-2
lines changed

3 files changed

+26
-2
lines changed

dev/tests/integration/testsuite/Magento/Framework/View/LayoutTest.php

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,17 +253,28 @@ public function testAddContainer($htmlTag)
253253
public function addContainerDataProvider()
254254
{
255255
return [
256+
['aside'],
256257
['dd'],
257258
['div'],
258259
['dl'],
259260
['fieldset'],
261+
['main'],
262+
['nav'],
260263
['header'],
264+
['footer'],
261265
['ol'],
262266
['p'],
263267
['section'],
264268
['table'],
265269
['tfoot'],
266-
['ul']
270+
['ul'],
271+
['article'],
272+
['h1'],
273+
['h2'],
274+
['h3'],
275+
['h4'],
276+
['h5'],
277+
['h6'],
267278
];
268279
}
269280

@@ -274,7 +285,7 @@ public function testAddContainerInvalidHtmlTag()
274285
{
275286
$msg = 'Html tag "span" is forbidden for usage in containers. ' .
276287
'Consider to use one of the allowed: aside, dd, div, dl, fieldset, main, nav, ' .
277-
'header, footer, ol, p, section, table, tfoot, ul, article.';
288+
'header, footer, ol, p, section, table, tfoot, ul, article, h1, h2, h3, h4, h5, h6.';
278289
$this->expectException(\Magento\Framework\Exception\LocalizedException::class);
279290
$this->expectExceptionMessage($msg);
280291
$this->_layout->addContainer('container', 'Container', ['htmlTag' => 'span']);

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,12 @@ class Container implements Layout\GeneratorInterface
4343
'tfoot',
4444
'ul',
4545
'article',
46+
'h1',
47+
'h2',
48+
'h3',
49+
'h4',
50+
'h5',
51+
'h6',
4652
];
4753

4854
/**

lib/internal/Magento/Framework/View/Layout/etc/elements.xsd

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,13 @@
140140
<xs:enumeration value="table"/>
141141
<xs:enumeration value="tfoot"/>
142142
<xs:enumeration value="ul"/>
143+
<xs:enumeration value="article"/>
144+
<xs:enumeration value="h1"/>
145+
<xs:enumeration value="h2"/>
146+
<xs:enumeration value="h3"/>
147+
<xs:enumeration value="h4"/>
148+
<xs:enumeration value="h5"/>
149+
<xs:enumeration value="h6"/>
143150
</xs:restriction>
144151
</xs:simpleType>
145152

0 commit comments

Comments
 (0)