Override the output - add html tag

Created on 15 March 2023, over 1 year ago
Updated 22 March 2023, over 1 year ago

Views > Configure field > Rewrite results > Override the output of this field with custom text
<tippy class="tippy-tooltip-text"{{ body_1 }} ">{{ field_rank }}</tippy>
I would like to add the above but it is NOT within the allowed HTML tags
Could someone advise where I can update this list please
Thank you, it should enable us to allow tool tip functionality even on a touch screen see screenshot

💬 Support request
Status

Closed: works as designed

Version

9.5

Component
Views  →

Last updated less than a minute ago

Created by

🇬🇧United Kingdom artatac

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

Comments & Activities

  • Issue created by @artatac
  • 🇮🇳India mehul.gada Mumbai

    Hi @artatac

    "tippy" is not a standard HTML tag. I guess you are trying to use "tippy.js" library to create nice-looking tooltips and it works on the specific class ("tippy-tooltip-text" in your case). So, why not use a span tag instead?

    Drupal is doing XSS filtering to skip harmful text and that's why tippy tag is getting stripped. This tag list is maintained in the core file - web/core/lib/Drupal/Component/Utility/Xss.php. Modifying this file is not recommended as you need to patch it. Alternatively, you can create a twig file in your custom theme to modify the field output. You can create a specific twig file with the name views-view-field--[view_machine_name]--[page OR block machine_name]--[field-machine_name].html.twig and add your custom HTML tags. But the best option will be to use the span tag instead as that would mean no custom code and not patching.

  • Status changed to Closed: works as designed over 1 year ago
  • 🇳🇱Netherlands Lendude Amsterdam

    Per #2 this indeed works as designed, good suggestions given there.

  • 🇬🇧United Kingdom artatac

    Really good advice thank you. So would
    <span class="tippy-tooltip-text"{{ body_1 }} ">{{ field_rank }}</span>
    Do what I need? The reason I wish to use it is it seems to give pop ups on touch screens which is great :-)

Production build 0.69.0 2024