In \Drupal\views\Plugin\views\filter\NumericFilter::valueForm()
we add form fields for both value
and min
/max
and then use #states
to hide those that don't apply for the currently selected operator.
However, if a child class overrides operators()
to provide its own set, which might not contain any operators with min/max (or none with a single value), these fields are still included and, worse, the absence of any #states
will leave them always displayed even though they are completely pointless.
While this is easy to fix in the child class, with a short override of the valueForm()
method, it would be as easy to fix once and for all in the parent class.
Comment | File | Size | Author |
---|---|---|---|
#21 | 2637674-21.patch | 3.15 KB | smustgrave |
#21 | interdiff-5-21.txt | 6.11 KB | smustgrave |
Comments
Comment #2
drunken monkeyThe attached patch would implement this.
Comment #3
borisson_This can be wrapped closer to 80 cols. But that's the only thing I found with the patch.
Comment #4
catchCan we make this $operators_with_one_value? Same for 2/two below.
Since this changes the form structure, it needs to go into 8.1.x
Comment #5
drunken monkeyThanks a lot for reviewing!
Attached is the updated patch with both these objections fixed.
Also thanks for moving this to the right branch!
Comment #20
smustgrave CreditAttribution: smustgrave at Mobomo commentedComment #21
smustgrave CreditAttribution: smustgrave at Mobomo commentedRerolled for 10.1
Still needs testing.