How to display another field of or a simple link to the taxonomy term in the tooltip

Created on 9 May 2023, over 1 year ago
Updated 14 May 2023, over 1 year ago

Problem/Motivation

Imagine the text is quoting a stock for which the site wants to show the price field on hover.
How would I do that? Thank you 🙏🏻

💬 Support request
Status

Needs work

Version

2.0

Component

Documentation

Created by

🇮🇹Italy kopeboy Milan

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

Comments & Activities

  • Issue created by @kopeboy
  • Status changed to RTBC over 1 year ago
  • 🇮🇹Italy kopeboy Milan

    Actually, this is already possible by editing/overriding the provided twig template at /templates/tooltip-taxonomy.html.twig, like:

    <span class="tx-tooltip" tabindex="0">
      {{ term_name }}
      <span class="tx-tooltip-text">
         {{ description }}
         <span class="your-custom-class">
            {{ entity.your_field }}
         </span>
      </span>
    </span>

    Don't forget to add your custom class or html element in the allowed tags of your text formats!

  • Status changed to Needs work over 1 year ago
  • 🇮🇹Italy kopeboy Milan

    Actually I was wrong, maybe a field I tested was displayed because of some other module or configuration giving me that token, but now I can't reproduce 😅

    I can't even provide a simple link to the taxonomy term.. how to?
    I see we have the twig variable "tooltip_id" but that is in the format [vocabulary_ID]-[term_ID], like "glossary-2", could we have the term id as a separate variable instead?

Production build 0.71.5 2024