Add option to hide exposed field labels

Created on 25 May 2022, about 2 years ago
Updated 22 June 2024, 6 days ago

Problem/Motivation

For building compact forms, it would be useful if there was an option to hide the label on fields.

Proposed resolution

Add an option for each exposed field to assign the ['#title_display'] = 'visually_hidden'; on the field.

Remaining tasks

Provide a patch.

User interface changes

An extra option would be provided on each field which would add ['#title_display'] = 'visually_hidden';

API changes

n/a

Data model changes

n/a

✨ Feature request
Status

Needs review

Version

7.0

Component

User interface

Created by

πŸ‡ΊπŸ‡ΈUnited States DamienMcKenna NH, USA

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.

  • πŸ‡―πŸ‡΅Japan matthewmessmer

    #3 works.

  • Status changed to RTBC 5 months ago
  • Status changed to Needs work 3 months ago
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Will need some kind of update hook for existing sites.

  • Status changed to Needs review about 2 months ago
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Added an update hook thoughts?

  • Status changed to Needs work about 1 month ago
  • πŸ‡©πŸ‡ͺGermany FeyP

    Thanks for working on this issue. I have a use case for this functionality in one of my projects, so I did a quick review. Unfortunately, I noticed an issue with the update hook. I confirmed that the update hook probably doesn't work as intended on a patched BEF 6.0.5 on Drupal 10.2.6. Since we're touching the code again anyway, I also added some rather nitpicky stuff as well, which is totally optional.

  • πŸ‡ΊπŸ‡ΈUnited States smustgrave
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    @feyp not sure I follow the suggestions? Do you want to add them to the MR?

  • πŸ‡©πŸ‡ͺGermany FeyP

    FeyP β†’ changed the visibility of the branch 3282228-add-option-to to hidden.

  • πŸ‡©πŸ‡ͺGermany FeyP

    FeyP β†’ changed the visibility of the branch 3282228-add-option-to to active.

  • Status changed to Needs review 6 days ago
  • πŸ‡©πŸ‡ͺGermany FeyP

    @smustgrave Sure. I pushed a new branch for 7.0.x to the fork and updated the code there to address my review. New MR for 7.0.x is MR 82. I also rebased MR 6.0.x and cherry-picked my commits there, pushed everything to MR 72, which is still for 6.0.x.

    I tested the update hook on Drupal 10.3.0 with the 7.0.x MR and I think it works as intended now. Note that I didn't re-test the 6.0.x MR after my changes, although I don't see how this shouldn't work.

    I added the string change for the description as a separate commit so you can easily revert it, if you don't agree with that one. Unfortunately, it looks like I don't have permission to resolve my own review comments on the MR 72, so they're still open.

    Here is a config export after the update hook with a single BEF view, only change was this one, just as intended:

    --- a/sync/views.view.better_exposed_filters_issue_3282228.yml
    +++ b/sync/views.view.better_exposed_filters_issue_3282228.yml
    @@ -124,6 +124,7 @@ display:
                       collapsible: false
                       collapsible_disable_automatic_open: false
                       is_secondary: false
    +                  hide_label: false
                     select_all_none: false
                     select_all_none_nested: false
                     display_inline: true
    
Production build 0.69.0 2024