-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
Extend Observer declaration in events.xml by new attribute ifconfig #38493
base: 2.4-develop
Are you sure you want to change the base?
Extend Observer declaration in events.xml by new attribute ifconfig #38493
Conversation
…fig. Similar to layouts xml files ifconfig is optional conditioner based on which Observer will be executed or not.
Hi @bartekAtconvert. Thank you for your contribution! Add the comment under your pull request to deploy test or vanilla Magento instance:
❗ Automated tests can be triggered manually with an appropriate comment:
Allowed build names are:
You can find more information about the builds here For more details, review the Code Contributions documentation. |
Failed to run the builds. Please try to re-run them later. |
@magento run all tests |
@magento create issue |
Failed to run the builds. Please try to re-run them later. |
@magento run WebAPI Tests |
Failed to run the builds. Please try to re-run them later. |
@magento run Unit Tests |
@magento run Static Tests |
@magento run Unit Tests |
@magento run Static Tests |
@magento run WebAPI Tests |
@magento run Database Compare |
@magento run Static Tests |
@magento run WebAPI Tests |
Ha I was just running into this this week! I was wondering whether it existed. My usecase; I wanted to add an ifconfig here in events.xml that checks for this config value from system.xml so I didn't have to do this in the observer. |
@magento run all tests |
@magento run all tests |
@magento run all tests |
@magento run Functional Tests B2B, Functional Tests EE, Functional Tests CE, Integration Tests, WebAPI Tests |
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.
For SVC failure we need to create an approval ticket and other failures seem flaky to me. Hence approving the PR.
Thank you for the contribution and collaboration! ✔️ QA Passed Steps to reproduce:
Before: ✖️ After: ✔️ Created a module with observer, and added Please refer the screenshot:
![]()
![]() Please find the custom module used to test this PR. Thank you. |
As the linked issue is tagged as feature request, moving this to on hold for PO confirmation. |
We have a confirmation from Product Owner on this feature request issue hence moving it back to Extended Testing. |
@magento run all tests |
@magento run all tests |
Raised internal approval Jira for the SVC failure. Moving this PR to Pending Approval now. We will proceed ahead on this once will get all the required approvals. |
Description (*)
Extension of Observer declaration in events.xml by new optional attribute ifconfig with appropriate handling of it.
Similar to usage of ifconfig in layout's xml files - it executes (or not) Observer depending on boolean value of given config path. The purpose is to condition Observer's execution on config paths representing module's state - usually <module/general/active> or <module/general/enabled> etc.
Manual testing scenarios (*)
a) When config path value equals to true - Observer should execute.
b) When config path value equals to false - Observer should not execute
c) When config does not exist (path does not represent any actual value) - Observer should not execute
Contribution checklist (*)
Resolved issues: