Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XML instruction referenceBlock does not allow template= or does it? #9771

Closed
jissereitsma opened this issue May 28, 2017 · 3 comments
Closed
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

Comments

@jissereitsma
Copy link
Contributor

Within the XML layout, you can reference a block using a <referenceBlock name="foobar"> statement. By manipulating its arguments (recommended) and actions (deprecated) you can update the template 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:

 <referenceBlock name="example" template="example.phtml" />

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 the template parameter is not allowed within a referenceBlock.

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 for blockReferenceType. Here the definition should include an additional line to allow for an optional argument template:

<xs:attribute type="xs:boolean" name="template" use="optional"/>
@korostii
Copy link
Contributor

korostii commented May 29, 2017

Your suggestion sounds like a perfect fix for the issue at hand.
You know, if you could provide a pull request with the fix, it would speed up the process a lot. Pull requests are processed rather quickly lately. And you did! Sorry, I didn't see it right away.

Keep up the good work! 🥇

@magento-team magento-team added Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development develop labels Jul 31, 2017
@magento-team
Copy link
Contributor

Internal ticket to track issue progress: MAGETWO-69555

@magento-engcom-team magento-engcom-team added Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development develop Issue: Format is not valid Gate 1 Failed. Automatic verification of issue format is failed labels Sep 11, 2017
@magento-engcom-team
Copy link
Contributor

@jissereitsma, thank you for your report.
The issue is already fixed in 2.2.0

@magento-engcom-team magento-engcom-team added 2.2.x Fixed in 2.2.x The issue has been fixed in 2.2 release line labels Sep 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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
Projects
None yet
Development

No branches or pull requests

4 participants