[regression] "Content: Has taxonomy term ID (with depth)": instead of displaying the untranslated term title, no term title is displayed

Created on 4 July 2024, 6 months ago
Updated 7 July 2024, 6 months ago

Problem/Motivation

Follow up to πŸ› Return translated term name on views "Content: Has taxonomy term ID (with depth)" Fixed which seems to have caused a regression where in certain situations the token replacement now returns no term label.

This might be caused when getTranslationFromContext return NULL, which according to the Interface docblock it can do, but looking at the implementation in \Drupal\Core\Entity\EntityRepository::getTranslationFromContext this will never happen.

Steps to reproduce

Navigate to a Taxonomy Term page in English and the term title is displayed.

Then navigate to the same Term page translated to another language and the term title is not displayed.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

πŸ› Bug report
Status

Active

Version

11.0 πŸ”₯

Component
TaxonomyΒ  β†’

Last updated 1 day ago

  • Maintained by
  • πŸ‡ΊπŸ‡ΈUnited States @xjm
  • πŸ‡¬πŸ‡§United Kingdom @catch
Created by

πŸ‡³πŸ‡±Netherlands Lendude Amsterdam

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

Comments & Activities

  • Issue created by @Lendude
  • πŸ‡¬πŸ‡§United Kingdom matt b
  • πŸ‡¬πŸ‡§United Kingdom matt b
  • πŸ‡¬πŸ‡§United Kingdom matt b

    I have done some further testing. The Term Title is displayed when there is content related to the term. When there is no content there is not Term Title, in English or a translated language. I added a new category called 'Test' with not content. There is no Term Title. When I add an article with the category of 'Test', the Term Title is then displayed on the Term page.

    My term pages are overriden by a view, but I cannot see anything obvious there that should not display the term title (the body is still displayed) if there is no content. I've also checked my theme and have removed any templates that might effect the term page display, cleared cacheds and still get the same results. So I don't think this is theme related.

    Here's my Taxonomy Term page config:

    uuid: 4d3e3f4f-a21d-424c-bb36-b7c569cc6648
    langcode: en
    status: true
    dependencies:
      config:
        - core.entity_view_mode.node.teaser
        - node.type.article
        - views.view.recordings_library_catalogue
      module:
        - node
        - taxonomy
        - user
    _core:
      default_config_hash: Gy5PaLdfFhtFSRqJxV-DBTF5AocKgNA2CsCNNEbvx4c
    id: taxonomy_term
    label: 'Taxonomy term'
    module: taxonomy
    description: 'Content belonging to a certain taxonomy term.'
    tag: default
    base_table: node_field_data
    base_field: nid
    display:
      default:
        id: default
        display_title: Master
        display_plugin: default
        position: 0
        display_options:
          fields:
            type:
              id: type
              table: node_field_data
              field: type
              relationship: none
              group_type: group
              admin_label: ''
              entity_type: node
              entity_field: type
              plugin_id: field
              label: ''
              exclude: false
              alter:
                alter_text: true
                text: '<h2>{{ type }}s:</h2>'
                make_link: false
                path: ''
                absolute: false
                external: false
                replace_spaces: false
                path_case: none
                trim_whitespace: false
                alt: ''
                rel: ''
                link_class: ''
                prefix: ''
                suffix: ''
                target: ''
                nl2br: false
                max_length: 0
                word_boundary: true
                ellipsis: true
                more_link: false
                more_link_text: ''
                more_link_path: ''
                strip_tags: false
                trim: false
                preserve_tags: ''
                html: false
              element_type: ''
              element_class: ''
              element_label_type: ''
              element_label_class: ''
              element_label_colon: false
              element_wrapper_type: ''
              element_wrapper_class: ''
              element_default_classes: true
              empty: ''
              hide_empty: false
              empty_zero: false
              hide_alter_empty: true
              click_sort_column: target_id
              type: entity_reference_label
              settings:
                link: false
              group_column: target_id
              group_columns: {  }
              group_rows: true
              delta_limit: 0
              delta_offset: 0
              delta_reversed: false
              delta_first_last: false
              multi_type: separator
              separator: ', '
              field_api_classes: false
          pager:
            type: full
            options:
              offset: 0
              items_per_page: 10
              total_pages: 0
              id: 0
              tags:
                next: β€Ίβ€Ί
                previous: β€Ήβ€Ή
                first: 'Β« First'
                last: 'Last Β»'
              expose:
                items_per_page: false
                items_per_page_label: 'Items per page'
                items_per_page_options: '5, 10, 25, 50'
                items_per_page_options_all: false
                items_per_page_options_all_label: '- All -'
                offset: false
                offset_label: Offset
              quantity: 9
              pagination_heading_level: h4
          exposed_form:
            type: basic
            options:
              submit_button: Filter
              reset_button: false
              reset_button_label: Clear
              exposed_sorts_label: 'Sort by'
              expose_sort_order: false
              sort_asc_label: Asc
              sort_desc_label: Desc
          access:
            type: perm
            options:
              perm: 'access content'
          cache:
            type: tag
            options: {  }
          empty:
            view:
              id: view
              table: views
              field: view
              relationship: none
              group_type: group
              admin_label: ''
              plugin_id: view
              empty: true
              view_to_insert: 'recordings_library_catalogue:page_1'
              inherit_arguments: true
          sorts:
            sticky:
              id: sticky
              table: taxonomy_index
              field: sticky
              relationship: none
              group_type: group
              admin_label: ''
              plugin_id: standard
              order: DESC
              expose:
                label: ''
                field_identifier: sticky
              exposed: false
            created:
              id: created
              table: taxonomy_index
              field: created
              relationship: none
              group_type: group
              admin_label: ''
              plugin_id: date
              order: DESC
              expose:
                label: ''
                field_identifier: created
              exposed: false
              granularity: second
          arguments:
            term_node_tid_depth:
              id: term_node_tid_depth
              table: node_field_data
              field: term_node_tid_depth
              relationship: none
              group_type: group
              admin_label: ''
              entity_type: node
              plugin_id: taxonomy_index_tid_depth
              default_action: 'not found'
              exception:
                value: all
                title_enable: false
                title: All
              title_enable: true
              title: '{{ arguments.tid }}'
              default_argument_type: fixed
              default_argument_options:
                argument: ''
              summary_options:
                base_path: ''
                count: true
                override: false
                items_per_page: 25
              summary:
                sort_order: asc
                number_of_records: 0
                format: default_summary
              specify_validation: true
              validate:
                type: 'entity:taxonomy_term'
                fail: 'not found'
              validate_options:
                bundles: {  }
                access: true
                operation: view
                multiple: 0
              break_phrase: false
              depth: 1
              use_taxonomy_term_path: false
          filters:
            langcode:
              id: langcode
              table: node_field_data
              field: langcode
              relationship: none
              group_type: group
              admin_label: ''
              entity_type: node
              entity_field: langcode
              plugin_id: language
              operator: in
              value:
                '***LANGUAGE_language_content***': '***LANGUAGE_language_content***'
              group: 1
              exposed: false
              expose:
                operator_id: ''
                label: ''
                description: ''
                use_operator: false
                operator: ''
                operator_limit_selection: false
                operator_list: {  }
                identifier: ''
                required: false
                remember: false
                multiple: false
                remember_roles:
                  authenticated: authenticated
                reduce: false
              is_grouped: false
              group_info:
                label: ''
                description: ''
                identifier: ''
                optional: true
                widget: select
                multiple: false
                remember: false
                default_group: All
                default_group_multiple: {  }
                group_items: {  }
            status:
              id: status
              table: taxonomy_index
              field: status
              relationship: none
              group_type: group
              admin_label: ''
              plugin_id: boolean
              operator: '='
              value: '1'
              group: 1
              exposed: false
              expose:
                operator_id: ''
                label: ''
                description: ''
                use_operator: false
                operator: ''
                operator_limit_selection: false
                operator_list: {  }
                identifier: ''
                required: false
                remember: false
                multiple: false
                remember_roles:
                  authenticated: authenticated
              is_grouped: false
              group_info:
                label: ''
                description: ''
                identifier: ''
                optional: true
                widget: select
                multiple: false
                remember: false
                default_group: All
                default_group_multiple: {  }
                group_items: {  }
            type:
              id: type
              table: node_field_data
              field: type
              relationship: none
              group_type: group
              admin_label: ''
              entity_type: node
              entity_field: type
              plugin_id: bundle
              operator: in
              value:
                article: article
              group: 1
              exposed: false
              expose:
                operator_id: ''
                label: ''
                description: ''
                use_operator: false
                operator: ''
                operator_limit_selection: false
                operator_list: {  }
                identifier: ''
                required: false
                remember: false
                multiple: false
                remember_roles:
                  authenticated: authenticated
                reduce: false
              is_grouped: false
              group_info:
                label: ''
                description: ''
                identifier: ''
                optional: true
                widget: select
                multiple: false
                remember: false
                default_group: All
                default_group_multiple: {  }
                group_items: {  }
          style:
            type: default
            options:
              grouping: {  }
              row_class: ''
              default_row_class: true
              uses_fields: true
          row:
            type: 'entity:node'
            options:
              view_mode: teaser
          query:
            type: views_query
            options:
              query_comment: ''
              disable_sql_rewrite: false
              distinct: true
              replica: false
              query_tags: {  }
          relationships: {  }
          link_display: page_1
          link_url: ''
          header:
            area:
              id: area
              table: views
              field: area
              relationship: none
              group_type: group
              admin_label: 'Term Title'
              plugin_id: text
              empty: false
              content:
                value: '<h2>{{ arguments.term_node_tid_depth }}</h2>'
                format: basic_html
              tokenize: true
            entity_taxonomy_term:
              id: entity_taxonomy_term
              table: views
              field: entity_taxonomy_term
              relationship: none
              group_type: group
              admin_label: ''
              plugin_id: entity
              empty: true
              target: '{{ raw_arguments.term_node_tid_depth }}'
              view_mode: full
              tokenize: true
              bypass_access: false
          footer:
            view:
              id: view
              table: views
              field: view
              plugin_id: view
          display_extenders: {  }
        cache_metadata:
          max-age: -1
          contexts:
            - 'languages:language_content'
            - 'languages:language_interface'
            - url
            - url.query_args
            - 'user.node_grants:view'
            - user.permissions
          tags: {  }
      page_1:
        id: page_1
        display_title: Taxonomy
        display_plugin: page
        position: 1
        display_options:
          query:
            type: views_query
            options: {  }
          defaults:
            footer: false
          display_description: ''
          footer: {  }
          exposed_block: false
          display_extenders: {  }
          path: taxonomy/term/%
          menu:
            type: none
            title: Articles
            description: ''
            weight: 0
            expanded: false
            menu_name: main
            parent: ''
            context: '0'
          tab_options:
            type: none
            title: ''
            description: ''
            weight: 0
        cache_metadata:
          max-age: -1
          contexts:
            - 'languages:language_content'
            - 'languages:language_interface'
            - url
            - url.query_args
            - 'user.node_grants:view'
            - user.permissions
          tags: {  }
    
  • πŸ‡¨πŸ‡­Switzerland sir_squall

    thanks Matt +1 (to follow the thread)

Production build 0.71.5 2024