magento / magento/community-features

'header' block name is ambiguous

Open
#33 0 comments 0 reactions 0 assignees View on GitHub
moved from magento2 Priority: P4
Dominant language
No language data
Stars
46
Forks
14
PR merge metrics
No merged PRs in 30d

Description

### Preconditions
1. Magento Enterprise 2.1.0
### Steps to reproduce
1. Add custom content to `html/header.phtml` for theme, or perform some sort of action on `header` block in XML via `referenceBlock`.
### Expected result
1. One would expect, based on the naming convention used here, that the affected block would be the page header.
### Actual result
1. 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`

XML for block, in `default.xml`:

```



welcome

```

**Original Report**: https://github.com/magento/magento2/issues/6577 by @tommypyatt

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with vendor/magento/module-theme/Block/Html/Header.php and the block declaration in default.xml. Trace how the header block and its welcome template are referenced, then review the impact on custom themes and XML layout overrides. Done means a maintainer-approved naming approach is documented and all affected references are consistently accounted for.

Written by the indexing model from the issue text.

Assessment

Tech stack
php, xml
Domain
frontend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.