magento / magento2

Prior to making any Submission(s), you must sign an Adobe Contributor License Agreement, available here at: https://opensource.adobe.com/cla.html. All Submissions you make to Adobe Inc. and its affiliates, assigns and subsidiaries (collectively “Adobe”) are subject to the terms of the Adobe Contributor License Agreement.
http://www.magento.com
Open Software License 3.0
11.47k stars 9.28k forks source link

Add support for ifconfig to referenceBlock #31337

Open Eddcapone opened 3 years ago

Eddcapone commented 3 years ago

Description (*)

If you are defining a new block, you can use ifconfig to only enable the block when a backend setting is true. This is not supported for referenceBlock. I created a module where I am modifiying the block contactForm from the module Module_Contact by replacing the template with my own.

I also created a setting for my extension where I can toggle it on or off. The template should only get overriden, if the setting is set to true. So I added ifconfig="company_contact/general/enabled" to referenceBlock

    <referenceBlock name="contactForm"
                    ifconfig="company_contact/general/enabled"
                    template="Company_Contact::form.phtml" />

But I get Element 'referenceBlock', attribute 'ifconfig': The attribute 'ifconfig' is not allowed., and therefor what I try is not possible.

Expected behavior (*)

It should not throw an error.

Benefits

More ways to customize magento

m2-assistant[bot] commented 3 years ago

Hi @Eddcapone. Thank you for your report. To help us process this issue please make sure that you provided the following information:

Please make sure that the issue is reproducible on the vanilla Magento instance following Steps to reproduce. To deploy vanilla Magento instance on our environment, please, add a comment to the issue:

@magento give me 2.4-develop instance - upcoming 2.4.x release

For more details, please, review the Magento Contributor Assistant documentation.

Please, add a comment to assign the issue: @magento I am working on this


:clock10: You can find the schedule on the Magento Community Calendar page.

:telephone_receiver: The triage of issues happens in the queue order. If you want to speed up the delivery of your contribution, please join the Community Contributions Triage session to discuss the appropriate ticket.

:movie_camera: You can find the recording of the previous Community Contributions Triage on the Magento Youtube Channel

:pencil2: Feel free to post questions/proposals/feedback related to the Community Contributions Triage process to the corresponding Slack Channel

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed after 14 days if no further activity occurs. Is this issue still relevant? If so, what is blocking it? Is there anything you can do to help move it forward? Thank you for your contributions!

Eddcapone commented 3 years ago

This is still a good idea in my oppinion.

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed after 14 days if no further activity occurs. Is this issue still relevant? If so, what is blocking it? Is there anything you can do to help move it forward? Thank you for your contributions!

Eddcapone commented 3 years ago

This is still a good idea in my oppinion.

rejith77 commented 2 years ago

@Eddcapone yes this makes perfect sense. i too arrived at the same position as yours. can't find a way to enable/disable module without if-config.i overrode .html and .js files from module_checkout

INblau-LucaGerhardt commented 2 years ago

I'd love to have this feature as well. Right now I implement this functionality with custom block in layout and rendering the original block as a child within the new block. This way ifconfig is usable, but it's a pretty ugly way to do it.

Eddcapone commented 2 years ago

Please magento, accept and work on this feature.

giangvdm commented 2 years ago

We have every reason to implement this as a new feature. Please accept and work on this one.

Eddcapone commented 2 years ago

@magento-devops As you can see, many people need this feature. Please consider working on it.

flaviosantos-dev commented 2 years ago

Would be great, in fact!

chloelangford commented 1 year ago

This would be really helpful!

agorbulin commented 1 year ago

Really good feature

joeshelton-wagento commented 1 year ago

This is the most intuitive approach to conditionally removing existing blocks from a custom module or theme.

thomasnordkvist commented 1 year ago

Would be great to have this feature