3

I have 2 profiles that have two different taxonomy term fields that point to the same vocabulary (the reason that I created 2 different fields instead of one is that I want the users that handle the two profiles to be able to select different amount of vocabulary terms). If I try to create an exposed filter (select list) in views 3 I can only create 2 different exposed filters: one for profileA and one for profileB. I want to be able to merge them into one.

The "Global Combine Fields" option does not work since I want to expose a select list and not an input field. All the relationships that I tried to create are specific to one field or another (and not to the targeting vocabulary for example).

My question is: can I create an exposed filter based on the vocabulary (instead of the fields) that will filter the profiles based on whether the specific term(s) that were selected are in either the profileA's field and profileB's field?

I would like to know whether this is possible directly in views 3 with a method that I'm missing or if I could create a custom exposed filter programmatically. If the answer is the latter, I would really appreciate if you could point me to an article that shows how you can create such an exposed filter (or a similar) since I do not have any experience at all in the specific field.

  • Lazy way around it: use the same field and limit the amount using form_alter/widget_alter/magic. – Capi Etheriel Jan 10 '14 at 0:05
1
+100

This probably doesn't answer your specific question, but this poses an alternate solution.

If you created two fields to allow the user to select a different number of terms, you could potentially do this with one field and a form_alter hook or validation.

The idea is that the form alter would change the number of allowed values based on some custom logic. Ideally this would make downstream functionality like views simpler because you're dealing with a single field.

The answer on this question may help give you ideas. How do I set the fixed amount of values to 11?

1

A similar question has been posted on https://drupal.org/node/357082 .

The author of the issue asked to combine an argument and pass to multiple filters: instead of filtering directly from arguments, the argument can be used as input value for regular filters. Moreover the filters can be set with the AND or OR operators. This solution is currently under discussion where you can find many ideas and different approaches.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy