The empty option for cshs dropdowns in Views exposed filters is "_none". This is causing problems for me as I am redirecting the submission of another View (with a standard taxonomy drop-down listing, not cshs) to my cshs enabled view. However it is standard for Views taxonomy drop-downs to have an empty option of "All". My redirection then gives me an "illegal value has been selected" type error as a result.
While my redirection is kinda custom, I would expect cshs to use "All" rather than "_none" for views exposed filter drop-downs. If you think about it a bit, we have a views exposed filter on a taxonomy, which if not completed returns all nodes regardless of their tag. It doesn't return nodes that have no tags applied. Logically the naming convention doesn't make sense.
My attached patch changes the empty value definition. This might also affect entity field widgets perhaps... where a value of "_none" might make more sense to be fair. However, this patch is just to get the conversation started and if you're willing to accept this change, we can look at supporting both scenarios fully.
| Comment | File | Size | Author |
|---|---|---|---|
| #12 | cshs-views_exposed_none_all-2825271-12.patch | 1.52 KB | br0ken |
Comments
Comment #2
br0kenComment #4
br0ken@stella, can we mark this issue as fixed?
Comment #5
stella commented@BR0kEN yeah I'm happy to, if it works for you for field api widgets.
Comment #6
br0kenComment #8
br0kenAnd now it's okay.
Comment #9
stella commentedSomething in the last commit on this issue has broken other regular exposed taxonomy selects in the same view and they don't appear and can't be configured with allowed values.
This error appears in the log:
Notice: Undefined index: value in Drupal\views\Plugin\views\filter\FilterPluginBase->buildExposedForm() (line 857 of core/modules/views/src/Plugin/views/filter/FilterPluginBase.php)Comment #10
br0ken@stella, unfortunately I cannot reproduce this. Could you export the view and post config here?
Comment #11
br0kenForget about previous message - I found it.
Comment #12
br0kenThis patch should fix it.
Comment #13
stella commentedYeah I was investigating it too. Tracked it down to the
parent::valueForm($form, $form_state);line needing to be at the start of the function. It actually started working for me then without the other changes, or at least I think it did. In any case I don't see any issues with your patch.Comment #15
br0kenComment #17
yi_wang commentedHi, I can't apply these patches to fix the using "_none" instead of "_all" issue. I tried all of them.
Drupal version 10.2.3
PHP 8.1.27