I have been tasked to customize a view, and I have been struggling with its exposed form, because I need to display some informations. Here is how it should look:


These elements act as a checkbox, but the number on the right is the number of nodes that have this tag linked.

So far, I have nothing code related, because I simply don't know how to handle this. The theme itself would accept an array of array, each of them containing the checkbox's text, its value, and this number, like so:

tabs: [
      label: "Topics",
      filtersType: "tag",
      filterName: "loremField[]",
      filters: [
          id: "lorem1",
          label: "Loremi",
          items: "5"
          id: "lorem2",
          label: "Loremi",
          items: "15"

However, I'm not able to either pass this "items" key to either the form, and I'm not sure at all that I can customize the input from the hook form alter. For a reference, here is the template:

<div class="c-tag-filters">
  {% for item in filters %}
    <div class="c-tag-filters__item">
      <input id="{{item.id}}" name="{{ filters.filterName }}" class="c-tag-filters__item__input" type="checkbox">
      <div class="c-tag-filters__item__content">
        <label for="{{item.id}}">{{item.label}} <span class="c-tag-filters__item__content--nb">{{ item.items }}</span></label>
  {% endfor %}

So, how should I proceed in this case?

Thank you in advance

Your Answer

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

Browse other questions tagged or ask your own question.