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 :
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.
Comment | File | Size | Author |
---|---|---|---|
#2 | 3117399-field-item-sub-properties-labels-should-not-end-with-a-period-character.patch | 2.61 KB | MiniDream |
| |||
dot-in-adresse.png | 11.9 KB | garphy |
Comments
Comment #2
MiniDream CreditAttribution: MiniDream commentedI garphy, i just attached a patch for this.
Comment #3
garphy CreditAttribution: garphy at ICI LA LUNE commentedComment #4
rokzabukovec CreditAttribution: rokzabukovec at Agiledrop - Your Trusted Drupal Teammates commentedI 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.
Comment #5
dwwSeems 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
Comment #6
bojanz CreditAttribution: bojanz at Centarro commentedSounds fine to me, the periods were not a conscious choice.
Comment #8
bojanz CreditAttribution: bojanz at Centarro commentedCommitted.