Question

I have been wrestling with this for a number of days. I apologize if this has been asked elsewhere, I am not able to find the fix, or maybe I am just not thinking in an incorrect way to make this work. One of my exposed filters searches using "Content:Has Taxonomy Term", I use the dropdown not autofill. With that created, I pull up my settings for better exposed filters. I expose my filter as checkboxes. the checkboxes that the Better Exposed Filters creates adds a number value to each of the checkboxes, not the taxonomy term name. Is there a way I can manipulate the output of the Better Exposed filter to show the name as the value, not id?

  1. Here I create add a filter/filter criteria. you can see on the left I added a Content Has Taxonomy term (exposed) enter image description here

  2. Here you can see the criteria. I have clicked the "expose the filter to visitors" to allow the visitor to select how to filter. I click a couple options in the select list to show different predetermined options. and not shown, I select the option "limit list to selected items" enter image description here

  3. from the highlighted 1st image above, shows settings for Better Exposed Filters. I click the setting option, and for the display of that criteria, and for that filter, display filter as checkboxes. enter image description here

  4. After that, I can preview my checkboxes here. enter image description here

  5. If you inspect each of those checkboxes, you can see the value assigned to the checkboxes, is a number. enter image description here

I believe it to be the Taxonomy Term ID?...

  1. In this next screenshot, you can see the value from the checkbox represented as the same id.

enter image description here

This is where I get stuck... I want to show the term as the taxonomy term name, not id.

thanks in advance for your help!

Was it helpful?

Solution

This has nothing to do with Exposed filter settings, it's to do with what information is stored in the Taxonomy term Entity Reference field on your Content Type, and it's the term ID, not the term name.

So when you add the most ready-available Taxonomy Fields/Filters to your Content Views you will get the term ID.

Other Taxonomy term information (term name included) is stored in another database table and you have to add the Relationship for that particular field in order to pull information from that table into Views.

What you want is to add the Relationship for the Field on your content that stores the Taxonomy term reference. You can require the Relationship if you only want to see nodes in results where that field isn't empty.

After you add that Relationship you will get more options under Fields and Filters, one of those options is the Taxonomy term Name. They will use the Relationship by default since they can't be added to the Views without it.

Add the Name Filter to your Views and expose it. Adjust the Vocabulary settings and other options to your particular need.

Licensed under: CC-BY-SA with attribution
Not affiliated with drupal.stackexchange
scroll top