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

CommentFileSizeAuthor
ourfallenScreen.png257.45 KBartatac

Comments

artatac created an issue. See original summary.

mehul.gada’s picture

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.

lendude’s picture

Status: Active » Closed (works as designed)

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

artatac’s picture

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 :-)