-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Conversation
Hi @bassplayer7! Thank you for your input! |
@bassplayer7 What I found out is that currently we don't have these internal standards. |
@bassplayer7, this is great. We'll discuss it internally. |
@almarchenko thanks for checking into this. @antonkril thanks for picking this up as well. The exact details don't much matter to me, but over time, I've felt that having at least a naming recommendation could help us identify blocks more instinctively. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added discussion comments.
Resolution:
- We agree that we need the standard for this.
- Concerns with the proposal were identified
Next steps:
- @benmarks will drive the proposed solutions to concerns
- The proposed solutions will be merged to the proposed standard and published
|
||
The `name` attribute should adhere to the guidelines listed below. The `name` attribute should: | ||
|
||
- Be unique to the project. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can not be enforced without a more specific rule (add namespace?)
The `name` attribute should adhere to the guidelines listed below. The `name` attribute should: | ||
|
||
- Be unique to the project. | ||
- Use a namespace approach where each child block's name contains its parent's name as well. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cons:
- @benmarks : it is a duplication of the structure. Layout structure can be modified ()
- @okorshenko : reusable declarations (renderer lists) will not be able to follow this approach
- will mix structure of blocks and multi-word block names (example: i want to call my bllock "my.block")
Pros:
- @buskamuza : will allow to see the original place of a block.
- @okorshenko : improves unique block naming
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding for the record (this is the salient point):
Use a namespace approach where each child block's name contains its parent's name
Because block names exist in the global layout scope, this isn't a "namespace approach"; rather, it's a hierarchy approach.
|
||
```xml | ||
<block name="header"> | ||
<block name="header.right"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Name" should not describe the position of a block. It should explain its purpose. We should add it as one of the rules.
|
||
The `as` attribute should follow the guidelines below. The value of `as`: | ||
|
||
- Only needs to be unique to the block that contains it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@benmarks : With current implementation, this one can be confusing for block substitution scenario (when we add a block with same alias to substitute a other child)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have an internal goal of having this complete tonight (12-Jun), but it will be a couple more days. Thanks again for proposing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do we expect in this scenario? I'd leave the statement as is.
Add PayPal to navigation - corrected for deploy work
@benmarks @antonkril |
Created another PR as I can't edit this one - #2051 |
I haven't gotten to this in a year, so consider me removed. |
Closing the proposal based on the discussion https://github.com/magento/architecture/wiki/October-31,-2018 |
The goal of this is to formalize a standard for writing layout XML. There hasn't been a standard set that the community follows when authoring layout XML. By setting a precedent for layout XML naming conventions, I am hopeful that it will lead to XML declarations that are easier to read and more consistent which could decrease maintenance time.
Note: this is identical to #982. I found that I did that PR on the wrong branch of my fork and needed to move over to this one to provide flexibility.