In D7 we had the ability to restrict entity events to a specific bundle type when configuring a Reaction Rule.
When you did "Add a reaction rule" in D7 you got an Ajax-enabled form. The form asked you to choose the rule name, machine id, tags, and description. Below that it asked you to select an event to react on. When the event was selected, if it was an entity event, then an additional selection was made available via Ajax to let you restrict the event to a specific bundle.
For example, if I chose: "After saving a new content item" (rules_entity_insert:node) I would then see a selection element allowing me to specify the bundle, or content type, of the event. For example if I only wanted to react on new "Article" nodes being added, I could turn this event into a qualified event: "After saving a new content item of type Article" (rules_entity_insert:node--article). Then, our reaction rule would only execute if an Article was created, and would not fire if any other content type was created.
This patch accomplishes all of the above for D8. It works completely, but there are still a few things I'd like to change before committing:
I'm not very happy with the way the event labels were modified in RulesEventManager. I also still need to port the test to WebDriver (I initially copied some of the test from known-good JavascriptTestBase code, so I wanted to ensure the patch works in the testbot before I started porting the test to WebDriver). I would also like to enhance the FunctionalJavascript test and add some Functional tests.
Please test and review this patch and let me know if I missed something.
EDIT: JavaScript test now ported to WebDriver.
| Comment | File | Size | Author |
|---|---|---|---|
| #13 | 3106987-13-event-bundle-selection-ui.patch | 20.84 KB | tr |
| #12 | 3106987-12-event-bundle-selection-ui.patch | 20.74 KB | tr |
| #11 | 3106987-11-event-bundle-selection-ui.patch | 22.88 KB | tr |
Comments
Comment #2
tr commentedWell, the Javascript tests passed, that's good news. Some Unit tests failed because I injected a new service into RulesEventManager but forgot to change the Unit tests to mock the new service. And there are some coding standards problems. But the patch still works, BTW, if you're inclined to test it - these are all just problems with the test functions.
I'll work on fixing the tests and adding new tests, and I'll post a new patch soon.
Comment #3
tr commentedHere's a trial port to WebDriver plus a fix for the Unit tests. The Functional test will still have failures because I haven't worked on those yet.
Comment #4
tr commentedComment #5
tr commentedLooks like there are still a few changes needed for the port to WebDriver.
Comment #6
tr commentedComment #7
tr commentedComment #8
tr commentedNow that it passes, let me enhance the JavaScript Ajax tests.
Comment #9
tr commentedHave to enable the taxonomy module if we're going to use taxonomy events ...
Comment #10
tr commentedHere with the enhanced JavaScript tests and some addition Kernel (not Functional) tests.
Comment #11
tr commentedComment #12
tr commentedSimplified patch a bit, added/improved some tests.
Comment #13
tr commentedMore cleanup.
Comment #15
tr commentedCommitted.