Term reference elements showing term Id instead of label

Created on 16 May 2020, over 4 years ago
Updated 4 September 2024, 24 days ago

I know that this module is being maintained rarely, but I appreciate anyone help me on this. When we use any taxonomy term reference elements the analysis result show term IDs instead of term label. It would be great if we could see the labels.

Feature request
Status

RTBC

Version

1.0

Component

Code

Created by

🇮🇷Iran jshosseini

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.

  • Issue was unassigned.
  • Status changed to Needs work about 1 year ago
  • 🇳🇱Netherlands llewellyn.dawson

    Tested the patch and did not work as intended.

    Returns no term fields.

  • 🇳🇱Netherlands batigolix Utrecht
  • 🇳🇱Netherlands EstherTempel

    I tested both #11 patch and #13 patch on a Drupal 10.2 clean installation with webforms version 6.2.
    What I noticed is that if you choose webform_entity_checkboxes, webform_entity_select and/or webform_entity_radios (this last one is added in patch #13) the label of the terms are correctly displayed.

    However if you choose webform_term_select the values are empty, nothing is displayed.
    And if you choose for instance webform_term_checkboxes (this element is not added in the patches) the ID is displayed instead of the label.

    What I notices while debugging is that webform_term_select skips this part of the code:

    if (isset($value) && !empty($value)) {
                if (isset($this->getElements()[$component]['#target_type'])) {
                  $target_type = $this->getElements()[$component]['#target_type'];
                  $entity_storage = \Drupal::entityTypeManager()->getStorage($target_type);
                  $entity = $entity_storage->load($value);
                  if (is_object($entity)) {
                    $value_label = $entity->label();
                  }
                }
              }
  • Status changed to Needs review 5 months ago
  • 🇳🇱Netherlands batigolix Utrecht

    Here is a new patch that also adds labels for Term select and Term checkbox elements.

  • 🇳🇱Netherlands batigolix Utrecht

    Here is a new patch rerolled after the PHPCS fixes

  • Status changed to RTBC 24 days ago
  • 🇳🇱Netherlands ross.rvt

    It works proper

    • 38fe7368 committed on 8.x-1.x
      Issue #3137260 by sokru, batigolix, mohit_aghera, nevergone,...
  • 🇳🇱Netherlands batigolix Utrecht
Production build 0.71.5 2024