XML instruction referenceBlock does not allow template= or does it? #9771
Labels
Fixed in 2.2.x
The issue has been fixed in 2.2 release line
Issue: Format is not valid
Gate 1 Failed. Automatic verification of issue format is failed
Issue: Ready for Work
Gate 4. Acknowledged. Issue is added to backlog and ready for development
Within the XML layout, you can reference a block using a
<referenceBlock name="foobar">
statement. By manipulating itsarguments
(recommended) andactions
(deprecated) you can update thetemplate
property just fine. However, the documentation http://devdocs.magento.com/guides/v2.0/frontend-dev-guide/layouts/xml-manage.html#set_template mentions you can also use the following syntax:When I try this, it works just fine. However, when opening up XML layout in PhpStorm, which is setup to respect the XSD of
urn:magento:module:View/Layout:etc/page_configuration.xsd
, it is mentioned that thetemplate
parameter is not allowed within areferenceBlock
.This either means that the documentation is incorrect or that the XSD is incorrect. I would suggest that the XSD is incorrect, because setting the template this way is useful.
Preconditions
I've been seeing this in all of the Magento 2.1 versions I've worked with. However, I also remember this used to work one time as well.
Suggested fix
Within the file
Magento_Framework/View/Layout/etc/elements.xsd
there is a definition forblockReferenceType
. Here the definition should include an additional line to allow for an optional argumenttemplate
:The text was updated successfully, but these errors were encountered: