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.

Comments

stella created an issue. See original summary.

br0ken’s picture

StatusFileSize
new893 bytes
new429 bytes

  • BR0kEN committed 4d5648e on 8.x-1.x
    Issue #2825271 by BR0kEN, stella: Views filter uses '_none' instead of '...
br0ken’s picture

@stella, can we mark this issue as fixed?

stella’s picture

@BR0kEN yeah I'm happy to, if it works for you for field api widgets.

br0ken’s picture

  • BR0kEN committed 3d529fb on 8.x-1.x
    Issue #2825271 by BR0kEN, stella: Views filter uses '_none' instead of '...
br0ken’s picture

Status: Needs review » Fixed

And now it's okay.

stella’s picture

Status: Fixed » Needs work

Something 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)

br0ken’s picture

Status: Needs work » Postponed (maintainer needs more info)

@stella, unfortunately I cannot reproduce this. Could you export the view and post config here?

br0ken’s picture

Status: Postponed (maintainer needs more info) » Needs work

Forget about previous message - I found it.

br0ken’s picture

Status: Needs work » Needs review
StatusFileSize
new1.52 KB

This patch should fix it.

stella’s picture

Status: Needs review » Reviewed & tested by the community

Yeah 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.

  • BR0kEN committed 6ab9803 on 8.x-1.x
    Issue #2825271 by BR0kEN, stella: Views filter uses '_none' instead of '...
br0ken’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

yi_wang’s picture

Hi, 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