layout | group | subgroup | title | menu_title | menu_order | version | github_link | redirect_from |
---|---|---|---|---|---|---|---|---|
default |
View library |
XML layouts and schemas |
XML layouts and schemas |
2.0 |
architecture/view/xml-schema-layout.md |
/guides/v1.0/architecture/view/xml-schema-layout.html |
In the Magento system, you define application page layouts in XML files, also known as layouts.
The system uses the Magento XML schemas to validate these layouts.
The Magento system uses the following XML schemas to validate these layouts:
Reviewer: The original topic mentioned 3 XSD files, two of which do not exist or have been renamed: layout_single.xsd, layouts.xsd, and layout_merged.xsd. I guessed that layout_single = layout_generic but I do not know the correct reference for layouts.xsd. Please provide this information.
Schema | Validates |
---|---|
layout_generic.xsd | Individual layouts |
layouts.xsd | Individual layouts. |
layout_merged.xsd | Merged layouts. |
These layout-specific XML schemas might use additional universal XML schemas.
The following table lists the allowable XML layout elements. The table reflects the correct structure for these elements.
Description | Attributes | Children |
---|---|---|
<layout> |
||
Mandatory root element. |
|
|
<block> |
||
A unit of a page output, which generates content. Each block corresponds to a Magento PHP class. Instantiate each block one time only. If the cacheable attribute is set to false for one block on the page, each request generates the whole page. |
|
|
<container> |
||
A placeholder for blocks and other containers. |
|
|
<update> |
||
The specified handle is "included" and executed recursively. |
|
|
<move> |
||
Sets the declared element as a child to another element in the specified order. |
|
|
<remove> |
||
Removes the specified element. |
|
|
<action> |
||
Invokes block method Will become obsolete eventually. It is being gradually replaced with non-imperative layout instructions. |
|
|
<referenceBlock> |
||
Wraps layout instructions, that is they will be executed in the context of the specified block. |
|
|
<referenceContainer> |
||
Wraps layout instructions, that is they will be executed in the context of the specified container. |
|
|
<arguments> |
||
A wrapper for arguments. |
|
|
<argument> |
||
Handles parameters that are injected into the parent block constructor during instantiation.
|
Use the following tests to validate new or changed layouts:
Test | Validates |
---|---|
HandlesTest.php | Layouts |
LayoutFilesTest.php | Argument values correspond to required data types |