Skip to content

Add Header (h1 - h6) tags to layout xml htmlTags Allowed types #23742

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Mar 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -253,17 +253,28 @@ public function testAddContainer($htmlTag)
public function addContainerDataProvider()
{
return [
['aside'],
['dd'],
['div'],
['dl'],
['fieldset'],
['main'],
['nav'],
['header'],
['footer'],
['ol'],
['p'],
['section'],
['table'],
['tfoot'],
['ul']
['ul'],
['article'],
['h1'],
['h2'],
['h3'],
['h4'],
['h5'],
['h6'],
];
}

Expand All @@ -274,7 +285,7 @@ public function testAddContainerInvalidHtmlTag()
{
$msg = 'Html tag "span" is forbidden for usage in containers. ' .
'Consider to use one of the allowed: aside, dd, div, dl, fieldset, main, nav, ' .
'header, footer, ol, p, section, table, tfoot, ul, article.';
'header, footer, ol, p, section, table, tfoot, ul, article, h1, h2, h3, h4, h5, h6.';
$this->expectException(\Magento\Framework\Exception\LocalizedException::class);
$this->expectExceptionMessage($msg);
$this->_layout->addContainer('container', 'Container', ['htmlTag' => 'span']);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ class Container implements Layout\GeneratorInterface
'tfoot',
'ul',
'article',
'h1',
'h2',
'h3',
'h4',
'h5',
'h6',
];

/**
Expand Down
7 changes: 7 additions & 0 deletions lib/internal/Magento/Framework/View/Layout/etc/elements.xsd
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,13 @@
<xs:enumeration value="table"/>
<xs:enumeration value="tfoot"/>
<xs:enumeration value="ul"/>
<xs:enumeration value="article"/>
<xs:enumeration value="h1"/>
<xs:enumeration value="h2"/>
<xs:enumeration value="h3"/>
<xs:enumeration value="h4"/>
<xs:enumeration value="h5"/>
<xs:enumeration value="h6"/>
</xs:restriction>
</xs:simpleType>

Expand Down