How to use in Views UI with rewritten text

Created on 30 May 2023, over 1 year ago
Updated 28 July 2024, 5 months ago

Problem/Motivation

I can't find a way to output a rewritten Views' field with Clipboard.js without writing custom code in a module, but I guess is a pretty common usecase.

Steps to reproduce

What doesn't work:

  1. Add a text field to your view, set "Formatter = Clipboard.js Button",
  2. Enable "Override the output of this field with custom text",
  3. Set "Text = my custom text {{ my_views_field }}"
  4. Output = your Text without Clipboard Button
  1. Add a Global: Custom text field to your view
  2. Set text to mimic the html of a previous field that already has the Clibboard.js formatter
  3. Discover you cannot use tag in the Custom text views' field.
  4. Substituting <button> with <div> doesn't trigger the clipboard.js

Custom text used:

<span class="clipboardjs clipboardjs-btn">
   <button class="clipboardjs-button" data-clipboard-alert="tooltip" data-clipboard-alert-text="Copied!" data-clipboard-text="my custom text">
      <div class="tooltip">
         <img class="clippy" src="/modules/contrib/clipboardjs/images/clippy.svg" alt="Click to copy" height="13" width="13">
         <span class="tooltiptext"></span>
      </div>
   </button>
</span>

Note: is also not currently possible to apply the Clipboard formatters (or any formatter) on a Global: Custom text field.

Proposed resolution

If this is already possible, please provide some documentation, otherwise make this a Feature request.

💬 Support request
Status

Active

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

Production build 0.71.5 2024