Active filter labels for hierarchical taxonomy filters display taxonomy term ID

Created on 19 August 2025, 28 days ago

Problem/Motivation

When I use a taxonomy filter that uses a hierarchical taxonomy, the active filter label displays the taxonomy term ID instead of the taxonomy term name.

Steps to reproduce

  1. Create a taxonomy with that contains a hierarchy, where you have parent and child terms.
  2. Add an exposed taxonomy filter to a view.
  3. In the taxonomy filter's settings, choose "Dropdown" for selection type and check the box that says "Show hierarchy in dropdown."

Proposed resolution

In the generateActiveFilters function, create a unified map of term IDs to term names from the #options array.

I have created a patch and will set up an issue fork shortly with the same code as this patch.

🐛 Bug report
Status

Active

Version

1.0

Component

Code

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @dev_lisa
  • Pipeline finished with Failed
    28 days ago
    Total: 311s
    #575988
  • Pipeline finished with Failed
    28 days ago
    Total: 286s
    #576002
  • Pipeline finished with Failed
    28 days ago
    Total: 374s
    #576009
  • 🇬🇧United Kingdom schillerm

    Hi, I tested and reviewed this, on a D11 site. When I tried to reproduce the problem on version 1.0.4 and also 1.0.x I got an error like this ..

    Drupal\active_filters\Plugin\views\area\ActiveFilters::rewriteLabel(): Argument #2 ($label) must be of type Drupal\Component\Render\MarkupInterface|string, stdClass given, called in /var/www/html/web/modules/contrib/active_filters/src/Plugin/views/area/ActiveFilters.php on line 269

    This seems to happen for all taxonomys (hierarchical or not). Tried this on D10.4 site - same error.

    If I fix that specific error in code then I can see ID's showing up as described in the issue.

    When I switch to using the !MR30 branch everything works. Tested on a view with multiple taxonomy fields. Looked at code changes, all seems fine.

    +1 for RTBC

  • 🇮🇹Italy apaderno Brescia, 🇮🇹
Production build 0.71.5 2024