Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
For example, if you have a rule with a condition based on page paths which do not correspond to a node content type, the Content type condition is still being saved and is checked in the rule entity isActive method: as this plugin has missing context on non-node pages the condition will fail and prevent the rule from activating.
The solution is to not save/add a plugin when it's form has no values. In the above example only the 'Pages' plugin would have anything in the form, so this is the only plugin which would be saved and participate in the condition check in isActive.
Comment | File | Size | Author |
---|---|---|---|
#2 | drupal-menu_position-condition-subform-processing-fixes.diff | 2.66 KB | pstewart |
Comments
Comment #2
pstewart CreditAttribution: pstewart commentedThe attached patch updates the conditions form handling to match the equivalent functionality in block for block visibility. With this patch applied, empty conditions are not saved and correct behaviour occurs on rules targeting non node pages.
Comment #3
Siegrist#2 works for me!
Comment #4
joelpittet@pstewart In core it looks like conditions forms don't show at all if the context doesn't exist, is this patch supposed to hide them similarly?
Comment #5
BarisW CreditAttribution: BarisW at LimoenGroen commentedThanks, the patch works as advertised. I'll commit it.
Comment #7
BarisW CreditAttribution: BarisW at LimoenGroen commented