Add an option to 'hide filter tips' on text fields

Created on 21 November 2022, over 1 year ago
Updated 16 May 2024, about 1 month ago

Problem/Motivation

https://www.drupal.org/project/allowed_formats is popular module (over 50 000 reported installations on D9/D10), the main feature was added to core on Allow text field to enforce a specific text format Fixed , but missed the option to hide sometimes confusing "about text formats" link and associated guidelines.

Steps to reproduce

Proposed resolution

Remaining tasks

  • Decision: Should the option to hide happen on field or widget level
  • update hook
  • tests for update hook

User interface changes

API changes

Data model changes

Release notes snippet

Original post by Berdir

We've seen that case in production with contrib, you are then forced to pick a new format, I don't think that's very problematic. But yes, test coverage makes sense.

There's one thing I'm wondering about. Beside this feature, the allowed_formats contrib module also has settings to hide the lengthy text format explanations, a feature that we use often. I'm a bit unsure how to handle that, for now you'd still need to use the contrib module for that, so it would require a new major version with a (post) update function and just those two settings? definitely don't want to delay this issue even further, maybe a follow-up that would allow us to move those into the same minor version?

Feature request
Status

Needs work

Version

11.0 🔥

Component
Text 

Last updated about 5 hours ago

Created by

🇺🇸United States smustgrave

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

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇦🇺Australia sime Canberra

    I thought I would have this problem, having just switched from allowed_formats to the new core feature. But for some reason filter tips are not showing for me on the form, just the discreet "About text formats" link. I assumed that allowed_formats was hiding them, but now I'm not so sure how they are hidden. There is just an empty div.

    >
    <div class="js-filter-guidelines js-form-wrapper form-wrapper filter-guidelines" data-drupal-selector="edit-field-summary-0-format-guidelines" id="edit-field-summary-0-format-guidelines" data-once="filter-guidelines">
    </div>
    </
  • 🇪🇸Spain idiaz.roncero Madrid

    +1000 to this

  • 🇪🇸Spain Eduardo Morales Alberti Spain, 🇪🇺

    +1001 to this

  • 🇮🇹Italy dgsiegel

    As a workaround you can hide it with this CSS snippet:

    /* Hide text format help text */
    .page-content .filter-wrapper {
      display: none;
    }
    
  • First commit to issue fork.
  • Merge request !5453Resolve #3323007 "Hide format tips" → (Open) created by plopesc
  • Status changed to Needs review 7 months ago
  • 🇪🇸Spain plopesc Valladolid

    Created MR to add the Hide Help and Hide Guidelines widget settings to core in a similar way as they are in Allowed Formats module.
    Also added basic test coverage.

    It will require some extra work, but let's use this initial approach to gather feedback and get the ball rolling.

  • Status changed to Needs work 7 months ago
  • 🇺🇸United States smustgrave

    Thanks for picking this up!

    So far seems good,

    The new schema changes will require an update hook + tests
    All the core text field config will have to be updated to include the new config

    For the form I imagine it could go right under "Allowed text formats"

  • 🇪🇸Spain plopesc Valladolid

    Thank you for your review @smustgrave!

    I was waiting for approach validation before going farther.

    Fixed the broken tests.

    Regarding the form, the idea is to define the settings at widget level, like in allowed_formats module, not at field level. But this can be discussed if the field level approach is preferred.

  • 🇫🇮Finland sokru

    Regarding the form, the idea is to define the settings at widget level, like in allowed_formats module, not at field level. But this can be discussed if the field level approach is preferred.

    +1 for adding it on widget level, so its easier to make allowed_format contrib module obsolete.

  • 🇦🇺Australia mstrelan

    As well as providing options on each entity form display it might be nice to have a global option that sets this once everywhere. The widget configuration should probably then have options to either use the site-wide default setting, or explicitly hide/show the help and guidelines.

  • 🇩🇪Germany diqidoq Berlin | Hamburg | New York | London | Paris

    @mstrelan was quicker :-) exactly what I wanted to add.

    +1 for a parent global and child sub setting overriding the global setting. Users are used to this from other admin UI experience. We have it in URL alias pattern, in states like "published" (default and on each node) and many other corners.

  • 🇧🇪Belgium samuhe

    MR seems good.

    +1 for having a global setting, overrideable on widget level.

  • 🇬🇧United Kingdom longwave UK

    If we wanted a global switch should this be a permission (or pair of permissions) provided by filter.module?

    Also, I've said this in other issues - checking a box to hide something feels the wrong way round, the checkbox should be checked if we are showing something.

  • 🇺🇸United States W01F

    +1 to "Display tooltips" per longwave's suggestion - my preference would be off by default.

  • 🇺🇸United States scotwith1t Birmingham, AL

    +1 here as well for off by default. i almost always end up hiding these.

Production build 0.69.0 2024