Problem/Motivation

Need to add multiple values for Dependent Facet settings when condition mode is set to: Check whether the facet is set to specific values.

Steps to reproduce

  1. Create a facet.
  2. Enable Dependent Facet.
  3. Enable a condition.
  4. Set condition mode to: Check whether the facet is set to specific values.
  5. Enter multiple values in the field.
  6. Multiple values will only be accepted when listed with a comma separator and no space. If not entered this way, only the first value will work.

Proposed resolution

Need to update line 205 in https://git.drupalcode.org/project/facets/-/blob/2.0.x/src/Plugin/facets... to trim the values.

Remaining tasks

User interface changes

Add help text to the field to tell people how to input multiple values.

API changes

Data model changes

Comments

tishmg created an issue. See original summary.

jaydev bhatt’s picture

Assigned: Unassigned » jaydev bhatt
jaydev bhatt’s picture

Assigned: jaydev bhatt » Unassigned
Status: Active » Needs review
StatusFileSize
new1.26 KB

I have added the field description for the field that appears on the "Dependent Facet - condition mode : Check whether the facet is set to specific values."

and on the same field i have also trimmed the extra white-spaces from both ends right and left

Status: Needs review » Needs work
jaydev bhatt’s picture

Assigned: Unassigned » jaydev bhatt
jaydev bhatt’s picture

Assigned: jaydev bhatt » Unassigned
Status: Needs work » Needs review
StatusFileSize
new1.25 KB

Replaced the array_walk() function with array_map() function.

tishmg’s picture

StatusFileSize
new1.28 KB

I tested out the patch and have verified the trim function works. I have included an updated patch to update the help text.

tishmg’s picture

Not sure why the patch failed. I tested it on Drupal 9.3 and PHP 8.0. I didn't see a way to change what version of PHP to test against.

smustgrave’s picture

StatusFileSize
new1.29 KB
new856 bytes

Patch #7 didn't apply cleanly for me so I rerolled it.

tishmg’s picture

facets-3279735-9.patch works for me! Tested on Drupal 9.3.16, php 8.0. Thank you so much everyone for all the work!

smustgrave’s picture

Status: Needs review » Reviewed & tested by the community
mkalkbrenner’s picture

Title: Dependent Facet does not allow multiple values when values are separated by spaces » Dependent Facet does not allow multiple values when values have leading spaces

mkalkbrenner’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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