diff --git a/source/php/Component/Typography/Typography.php b/source/php/Component/Typography/Typography.php index c18dd899..f01888b8 100644 --- a/source/php/Component/Typography/Typography.php +++ b/source/php/Component/Typography/Typography.php @@ -42,12 +42,16 @@ public function init() { private function getVariant($variant) { $element = $this->data['element']; - if (!$variant) { return $element; } + + + if (in_array($element, ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'])) { + if (in_array($variant, ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'])) { + return $variant; + } - if (in_array($element, ['h1', 'h2', 'h3', 'h4', 'h5', 'h6']) && !in_array($variant, ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'])) { trigger_error( sprintf( 'Element "%s" and variant "%s" cannot be combined. Heading elements must use a heading variant.', @@ -56,6 +60,7 @@ private function getVariant($variant) { ), E_USER_WARNING ); + return $element; }