Add custom content to html/header.phtml for theme, or perform some sort of action on header block in XML via referenceBlock.
Expected result
One would expect, based on the naming convention used here, that the affected block would be the page header.
Actual result
This is actually a block that outputs a welcome message within the header.
I'm not entirely certain if this is the correct place for this discussion. Apologies if it's not.
I'm putting together a blank theme at the moment. This naming issue causes me concern because I am finding it difficult to put together something easy to use. It would be nice if I could use the name header.phtml for my template and the block name header for my page header, as I think this is the most intuituve. I cannot do this however because there is a 'welcome' block in Magento with a template reference hard-coded (not via XML) to my intended template name, and with its block name set to header
Maybe a different name for this block, such as welcome-message, would be more appropriate?
File where template name is set:
vendor/magento/module-theme/Block/Html/Header.php
Preconditions
Steps to reproduce
html/header.phtml
for theme, or perform some sort of action onheader
block in XML viareferenceBlock
.Expected result
Actual result
I'm not entirely certain if this is the correct place for this discussion. Apologies if it's not.
I'm putting together a blank theme at the moment. This naming issue causes me concern because I am finding it difficult to put together something easy to use. It would be nice if I could use the name
header.phtml
for my template and the block nameheader
for my page header, as I think this is the most intuituve. I cannot do this however because there is a 'welcome' block in Magento with a template reference hard-coded (not via XML) to my intended template name, and with its block name set toheader
Maybe a different name for this block, such as
welcome-message
, would be more appropriate?File where template name is set:
vendor/magento/module-theme/Block/Html/Header.php
XML for block, in
default.xml
:Original Report: https://github.com/magento/magento2/issues/6577 by @tommypyatt