-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Update typeReferenceBlock definition #18933
Update typeReferenceBlock definition #18933
Conversation
Including the "class" attribute to the typeReferenceBlock definition allows you to update a block class when overriding or updating a layout.xml file without the need to remove the original block and re-add it with the same name but different class.
Hi @leandrommedeiros. Thank you for your contribution
For more details, please, review the Magento Contributor Assistant documentation |
@leandrommedeiros nice catch! This is exactly what we needed in scope of #11709 (comment) already. @antonkril @buskamuza could you please clarify if there was some reasoning behind disallowing |
I don't remember a specific reason. |
Hi @leandrommedeiros could you please submit a proposal as a PR to https://github.com/magento/architecture to be approved by architects. cc @orlangur |
@sivaschenko I'm supposed to do it actually including discussion already performed in |
Hi @leandrommedeiros , I am closing this PR now due to inactivity. |
Reopening the PR as it is a dependency for #11709 . A proposal was submitted to Architectural Discussions that is scheduled 23rd January 2019: magento/architecture#59 (comment) |
@orlangur @leandrommedeiros please consider attending the public architecture meetup 23rd January to discuss this change. |
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.
@buskamuza @sivaschenko I'm not sure what's the process is but from magento/architecture#85 this architectural change seems to be approved.
Hi @orlangur, thank you for the review. |
@leandrommedeiros thank you for contributing. Please accept Community Contributors team invitation here to gain extended permissions for this repository. |
Hi @leandrommedeiros, thank you for your contribution! |
Description (*)
Including the "class" attribute to the typeReferenceBlock definition allows you to update a the class attribute of a block tag when overriding or updating a layout XML file without the need to remove the original block and re-add it with the same name but different class and without using a preference in the Dependency Injector.
Manual testing scenarios (*)
Simple scenario:
Scenario I applied:
My wish was to create my own Admin Report using the Magento's Report New Accounts as a basis, but without the "Period" dropdown in the toolbar, so here's what I did:
I created the new Block class MyVendor\CustomReports\Block\Adminhtml\Grid extending the \Magento\Reports\Block\Adminhtml\Grid class.
I overrided the value of the attribute $_template to MyVendor_CustomReports::grid.phtml.
I copied Magento/Reports/view/templates/grid.phtml to MyVendor/CustomReports/view/templates/grid.phtml and edited it to erase the select element.
This worked as fine as any other fallback, but it was only possible editing the elements.xsd file (this PR), otherwise you get a "invalid attribute 'class'" exception.
Contribution checklist (*)