Does not show terms in hierarchy

Created on 30 April 2020, about 4 years ago
Updated 17 June 2024, 11 days ago

I have a view with a filter "Has taxonomy terms (with depth)" and "Show hierarchy in dropdown".

My vocabulary has the terms

a
-ab

and the only node is tagged with ab.

Now SBEF should show

a
-ab

but only shows

a

It appears that the module cannot handle taxonomy hierarchy filters yet.

Also I get an error message

Notice: Undefined index: field_name in Drupal\selective_better_exposed_filters\Plugin\better_exposed_filters\filter\SelectiveFilterBase::exposedFormAlter() (line 68 of modules/selective_better_exposed_filters/src/Plugin/better_exposed_filters/filter/SelectiveFilterBase.php).

✨ Feature request
Status

Active

Version

2.0

Component

Code

Created by

πŸ‡©πŸ‡ͺGermany demonde

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡«πŸ‡·France paul_leclerc Lausanne Switzerland

    @jrochate, it appears to me that using the field that targets the taxonomy as a filter only result to a textfield that required the term id.
    Its means that selective_better_exposed_filters needs verf β†’ module to works properly ?

  • πŸ‡΅πŸ‡ΉPortugal ricardofaria

    Having the same error after selecting "use only used terms". Using as filter criteria.

  • πŸ‡§πŸ‡ͺBelgium davidiio

    Hi everyone!
    We had the same problem using the module selective_better_exposed_filters trying to reduce the number of options of a "taxonomy term with depth" filter.
    I made small ugly patch.
    Noticing the $filter->definition['field_name'] could not be found and so the $field_id variable could not be set I have set it after using this code:

    if($field_id == NULL) {
       $field_id = $filter->options['reference_field'];
    }
    

    I guess a better approach would be to check if the filter is indeed a "taxonomy_term_with_dpeth" filter but I really could not find this info when inspecting the $filter variable :(

  • I am not having trouble with fields, but rather trying to reduce a term filter itself:
    (Taxonomy term) Taxonomy term: Term (exposed)

    This doesn't seem to work at all. I get the following:
    Warning: Undefined array key "field_name" in Drupal\selective_better_exposed_filters\Plugin\better_exposed_filters\filter\SelectiveFilterBase::exposedFormAlter() (line 68 of /var/www/html/web/modules/contrib/selective_better_exposed_filters/src/Plugin/better_exposed_filters/filter/SelectiveFilterBase.php)

    I have a custom entity with a term entity reference base field. Adding the filter from the field doesn't give the term settings, so you have to add it through the relationship to the term.

    Module doesn't seem to support that.

  • Status changed to Closed: won't fix 9 months ago
  • πŸ‡ΊπŸ‡¦Ukraine stomusic Ukraine

    Sorry, but I see no possibilities to work with "Has taxonomy terms (with depth)" filter because current logic based on retrieving of results some reference field data and this filter missing any info about related field.

  • Status changed to Active 11 days ago
  • πŸ‡³πŸ‡±Netherlands Willempje2

    TaxonomyIndexDepth is a bit different because it has the taxonomy_index table unlike other entities.
    Maybe we could utilize this instead of field references.

    See patch.

    There is some redundancy ( checking all related terms ) in here which could have impact on performance.
    In our cases this does not seem to give any issues.

Production build 0.69.0 2024