Here is the scenario :

We've got a taxonomy vocabulary called regions, this holds continents as parents and countries as children, this vocabulary then is used as a taxonomy term field in a content type called "Note", there user can select unlimited countries for the content. The user is forced to select from children so he/she cant choose a continent for that field.

Now I'm working on a view of "Notes", the country filter is exposed and user can select multiple countries, What I want now is to separate countries based on the continent they belong and show them in different part of form.

I know I can add a filter for each continent and select countries related to that continent using views but I'm looking for a programmatically based situation as the number of countries are so many and there might be human fault selecting proper countries for each continent.

1 Answer 1


You have to use an additional module to influence how the Exposed filter is displayed: Views Reference Filter.

This module adds special new Filters to Views that rely on (existing) Entity reference Views Displays to filter the View. Basically, it's filtering one View Display with another View Display.

In your case, you first have to:

  1. create an Entity reference Views Display that shows all the Countries, grouped by their Continents. It will be the Term type of View, not Content.

    You're designing here what your Exposed Filter will later look like.

  2. List Countries as Fields,
  3. then use Parent item Relationship to show Continent for each Country,
  4. Group the results by Continent (Parent) field in the Entity Reference list settings

    You will now see a list of Countries grouped by Continents.

  5. Save the View

With this ready you can:

  1. edit your "Note" Content view,
  2. add a new Filter Has taxonomy term that has (reference filter) in its name, expose it, and choose the Entity reference Display you created in previous steps above.
  3. Use Better exposed filters module to display the choices as Checkboxes

You will now have a working Exposed filter by Countries that will be grouped by Continents.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.