Allow HTML in views field labels

Created on 5 May 2012, over 12 years ago
Updated 11 September 2024, 2 months ago

Problem/Motivation

Views field labels are rendered as plain text only, so HTML cannot be used.

Steps to reproduce

  1. Install Drupal
  2. Edit the content admin view
  3. Edit the 'Title' field, and add HTML to the label, e.g. <strong>Title</strong>
  4. See that the HTML is rendered as plain text

Proposed resolution

Potentially allow HTML here?

Remaining tasks

  1. Confirm this is something we want to do
  2. Implement
  3. Review
  4. Commit

User interface changes

N/A

Introduced terminology

N/A

API changes

N/A

Data model changes

N/A

Release notes snippet

TBC

Original report

I need to create a some labels with custom HTML. I see my label is currently checkplain'ed and I cannot find a checkbox to allow HTML. Trustworty users should be able to add HTML code into the views labels... How can I stop views running checkplain?

Example label:
<acronym class="custom-font" title="Male">&#9794;</acronym> (all)

I must set a custom-font for the β™‚ char as it looks very bad in Verdana and I need to change this to Lucida Console or any other. I see no way around. The rest of the label should stay as is in Verdana.

✨ Feature request
Status

Active

Version

11.0 πŸ”₯

Component
ViewsΒ  β†’

Last updated about 3 hours ago

Created by

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

  • Needs backport to D7

    After being applied to the 8.x branch, it should be considered for backport to the 7.x branch. Note: This tag should generally remain even after the backport has been written, approved, and committed.

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.

  • πŸ‡¦πŸ‡ΊAustralia acbramley

    This was triaged as part of BSI. Is this bug still relevant? It may have been a duplicate of #2363423: views-view-fields.html.twig gets escaped β†’ ?

    If not, please update the issue summary with the standard template including steps to reproduce the issue from a fresh Drupal installation.

  • πŸ‡³πŸ‡ΏNew Zealand quietone

    As stated in #75, we need more information to move forward with this issue, If we don't receive additional information to help with the issue, it may be closed after three months.

    Thanks!

  • πŸ‡©πŸ‡ͺGermany osopolar πŸ‡©πŸ‡ͺ GER 🌐

    For me it still seems to be relevant. I just edited the default content view (under /admin/structure/views/view/content) to reproduce the issue. There I added an new field with html in the label. The html of the label gets escaped. Switching to a different display style (i.e. unformatted list) has the same result.

  • Status changed to Active 2 months ago
  • πŸ‡¦πŸ‡ΊAustralia pameeela

    I think it's clear this is intentional, so converting to a feature request to see if there is support for allowing HTML in the field labels.

  • πŸ‡¦πŸ‡ΊAustralia pameeela

    Hiding patches, need an MR.

Production build 0.71.5 2024