Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
The collapsable form box is labelled "conditions" but you can only set one of them. I want to show a field only if two other fields are empty. I think it can be done with rules but it seems like a basic case that the UI should cover.
Comment | File | Size | Author |
---|---|---|---|
#2 | ffc-allow-multiple-conditions-2215567-2.patch | 6.83 KB | mducharme |
Comments
Comment #1
dshields CreditAttribution: dshields commentedAny movement on this? Anyone else need this functionality?
I think multiple conditions would be a huge advantage in some contexts.
Comment #2
mducharme CreditAttribution: mducharme commentedHere's the initial implementation for review. I believe that I got all of the edge cases and bugs worked out. Looking for feedback on the UI and functionality. I believe that the "remove only" option for saved conditions makes sense. I also haven't touched the tests so those will likely need updating as well...
Up for discussion is the "and" operation for multiple conditions (default functionality) and whether we should be able to select the same condition multiple times per field. I opted for allowing only one condition type but it sounds like the initial use case would require multiple conditions of the same type which wouldn't be difficult to do.
Comment #4
dshields CreditAttribution: dshields commentedThis seems to work - thanks, mducharme!
Comment #5
elvizzi CreditAttribution: elvizzi commentedPatch #3 says, failed testing? Any more work being done on this or releasing a new dev release?
Comment #7
rootworkThe patch in #2 still applies (although weirdly, only using
patch -p1 < [patchfile]
rather thangit apply < [patchfile]
) and works in 7.x beta2 as well as 7.x dev.Tests were added at some point and indeed, this patch does not update those tests and therefore fails several of them.
But this module hasn't had a commit since 2013. So I think it's safe to say this might be the best you're going to get, unless you or someone else wants to update those tests.
Marking this as needs work as technically those tests should be fixed, but for most people the patch in #2 will be the solution.
Comment #8
rootworkOh, but I should point out that the patch in #2 only allows for multiple different type conditions. In other words, if you have one condition that is "Hide when target field does not contain a string," you can't have a second condition of that type, even targeting another field. But with this patch you can add another condition of, say, "Hide if target field is empty."
So perhaps another reason to explore more work on this patch.