Problem/Motivation

When checking the Multiple options box in the Contextual Filter 'More' settings, the option will not save.

Steps to reproduce

I'm using the People view:
1. Add Contextual Filter
2. Select Users: Roles as the filter
3. Check Multiple in the 'More' section
4. Hit Save
5. Go back and check to see if it's saved (It hasn't... on two separate sites running Drupal 9.4.8

CommentFileSizeAuthor
#3 3318108-3.patch2.64 KBlendude
#3 3318108-3-TEST_ONLY.patch1.91 KBlendude

Comments

rreedy created an issue. See original summary.

lendude’s picture

Title: Views Contextual Filters Multiple Option not saving » Views Roles Contextual Filters Multiple Option not saving

Confirmed, but its specific to the roles contextual, the rest work, quick scan didn't point me in the direction of a fix yet.

lendude’s picture

Status: Active » Needs review
StatusFileSize
new1.91 KB
new2.64 KB

Here we go, test and fix.

Not 100% sold on the fix being in the base class. I can't think of why we would only allow this on numeric fields other than the possibility of digging yourself in a hole when using string values that contain special characters.
But the fix with less possible side effects would be to just set the default only in RolesRid, but since this is only used by two classes in core anyway, not sure why we shouldn't fix this in the base class, so that is what I did here.

The last submitted patch, 3: 3318108-3-TEST_ONLY.patch, failed testing. View results

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community

Tested following the steps in the issue summary.

Tried different combos of the "Allow multiple values" and "Allow multiple filter values to work together"
Saved the view entirely and went back in to edit. and it all worked.

rreedy’s picture

Is it safe to use the 3318108-3.patch patch now? If so I'm planning on implementing in the next week, but wanted to be sure it was good to go (Sorry i'm still kind of new here and don't fully know the procedure).

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Given the default is false I think this is fine. If you know your strings do not contain pluses that you are fine to use this.

Committed and pushed 6124da7496 to 10.1.x and f41b3c6ffc to 10.0.x and db7e48bf38 to 9.5.x. Thanks!
Committed 458f241 and pushed to 9.4.x. Thanks!

Credited @rreedy for filing the bug report.

  • alexpott committed 6124da7 on 10.1.x
    Issue #3318108 by Lendude, rreedy: Views Roles Contextual Filters...

  • alexpott committed f41b3c6 on 10.0.x
    Issue #3318108 by Lendude, rreedy: Views Roles Contextual Filters...

  • alexpott committed db7e48b on 9.5.x
    Issue #3318108 by Lendude, rreedy: Views Roles Contextual Filters...

  • alexpott committed 458f241 on 9.4.x
    Issue #3318108 by Lendude, rreedy: Views Roles Contextual Filters...

Status: Fixed » Closed (fixed)

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