Almost all address field item (sub) properties define their label with an ending period (.) character.

An example, in AddressItem.php :

    $properties['administrative_area'] = DataDefinition::create('string')
      ->setLabel(t('The top-level administrative subdivision of the country.'));
    $properties['locality'] = DataDefinition::create('string')
      ->setLabel(t('The locality (i.e. city).'));
    $properties['dependent_locality'] = DataDefinition::create('string')
      ->setLabel(t('The dependent locality (i.e. neighbourhood).'));

It's a bit unconventional as field labels in Drupal don't usually[1] end with a period character, as opposed to field description which often are full sentences, thus end with a period char.

As a result, it's a bit clumsy when one want to use, say a JSON Schema, automatically generated from field and property definitions, to power a frontend experience as in the following example :

Example of clumsy field labels ending with a '.' character.

I would suggest that we get rid of those commas in such label. It would be straighforward for the theme/frontend layer to add a '.' at the end if it desires to do so. (but much more difficult to get rid of it if it's not supposed to be here in the first place). Another way would be to keep them as description and replace the label with a more terse wording.

As a side note, it seems that the module actually never uses those label/description properties (see LabelHelper.php)

[1] I wasn't able to find a single example of a field label ending with a comma in Drupal core.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

garphy created an issue. See original summary.

MiniDream’s picture

garphy’s picture

Status: Active » Needs review
rokzabukovec’s picture

Status: Needs review » Reviewed & tested by the community

I don't know if this is really the desired behavior but the patch provided in #3 applied cleanly so I'm setting this to RTBC.

dww’s picture

Assigned: Unassigned » bojanz

Seems okay to me, but I think @bojanz should take a look before we commit (in case there are reasons not to do this).

Thanks,
-Derek

bojanz’s picture

Sounds fine to me, the periods were not a conscious choice.

  • bojanz committed 1ee4720 on 8.x-1.x authored by garphy
    Issue #3117399 by garphy: Field item sub-properties labels should not...
bojanz’s picture

Status: Reviewed & tested by the community » Fixed

Committed.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.