Inconsistencies in subfields label visibility in formatter

Created on 2 January 2025, 3 months ago

Problem/Motivation

The possibility of showing/hiding the labels of subfields is cumbersome in the formatter: there is a general option to "show labels" that actually set the visibility of all or none labels. Then each subfield has an option to show or not the label but this is not taken into account since just the general option is applied.

Steps to reproduce

Create a custom field with a couple of subfield.
Play with the general option of "show labels" and specific show label options in each subfield.

Proposed resolution

Remove the general "show labels" option and enforce the specific subfield options.

Remaining tasks

Test

User interface changes

Yes

API changes

Data model changes

🐛 Bug report
Status

Active

Version

3.0

Component

Code

Created by

🇮🇹Italy giuse69

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

Comments & Activities

  • Issue created by @giuse69
  • 🇺🇸United States apmsooner

    I'm not sure what you mean with the general option of "show labels". I don't know of that setting. Are you referring to the Label display field in the manage display page for each field? That setting is specifically for each subfield whereas the other one I think you are referring to is for the main field itself. For instance if you have a custom_field called "Contact", the main label dropdown is for that label whereas the subfield labels might be related to for example: Name, Phone, E-mail, etc...

  • 🇮🇹Italy giuse69

    Hi, there are 3 places in Manage Display about showing labels:
    1) the label settings for the overall field => no problem
    2) the "show labels?" settings in the format of the overall fields - this is the one that is used to display or not the labels of ALL the subfields
    3) the "label display" setting for each subfield, and one of the possible values is "hidden".
    Now the problem is the inconsistency between the values of 2) with the values of the 3)s.
    is it more clear now?
    thanks

  • 🇺🇸United States apmsooner

    The only place I see "show labels" is for the "Inline" formatter. Is that what you are referring to? The subfield label settings for that aren't even evaluated for that formatter type and I should remove those. The "show labels" setting for that is the only thing thats evaluated. If thats what you're seeing, I'll update the logic to hide that unused setting in the subfields. It only really applies to the default formatter which is what is commonly used.

  • 🇮🇹Italy giuse69

    Yes, sorry I didn't say it earlier: it's in the inline formatter. I'd like to be able to show the label of a subfield and not the label of another one, so I'd prefer that the subfield labels are evaluated instead of the general one.

  • 🇺🇸United States apmsooner

    I don't know that we make that change. The dropdown field should never have been there honestly as it doesn't even make sense to possibly have an "Above" setting where the label is always supposed to be inline. I think we should definitely hide that field as it just won't make sense. We could possibly add another checkbox I guess for each subfield specifically for that formatter type. I think its probably not too common of a need though. I've got some other work I'm doing for formatters so let me knock that stuff out first and can revisit this request later. I think i'll change this category though to feature request as its not really a bug, the main setting works... it's just confusing to have the other one serving no purpose.

  • 🇺🇸United States apmsooner

    @giuse69, can you test the new feature in: https://www.drupal.org/project/custom_field/issues/3496708 Formatter wrapper tags, classes, etc. Active ?

    I've also unset the non-applicable label display setting in formatters like inline. I will then provide a solution for hiding the label in next release to resolve this ticket.

    Thanks

  • 🇺🇸United States apmsooner

    @giuse69, as I've removed the confusing unused label settings as part of this ticket ( https://www.drupal.org/project/custom_field/issues/3496708 Formatter wrapper tags, classes, etc. Active ), as well as enhanced the ability to set the tags you want in the default formatter, I'm thinking any additional features right now for the inline formatter may not make a whole lot of sense. The default formatter with tag support IMO would give you the most flexibility and if you need anything beyond that, I'd recommend getting into customizing the twig templates to your needs.

Production build 0.71.5 2024