Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
This causes an empty label and container to be rendered even if there is no map.
This is because it still returns a full elements array even if there are no items in it. Small patch attached that fixes this.
Comment | File | Size | Author |
---|---|---|---|
#4 | geofield-issue-1915050-label-display-even-if-no-data.diff | 754 bytes | Jelle_S |
#2 | geofield-issue-1915050-label-display-even-if-no-data.diff | 754 bytes | maijs |
geofield-empty-field-formatter.patch | 924 bytes | Paul Lomax | |
Comments
Comment #1
Paul Lomax CreditAttribution: Paul Lomax commentedComment #2
maijs CreditAttribution: maijs commentedThis issue is still unresolved. The field label is displayed even if there is no data input by user.
The patch provided by @Paul Lomax didn't work for me. This patch uses the same concept and is against 7.x-2.x-dev.
Comment #3
ducktape CreditAttribution: ducktape commentedPatch in #2 works as expected.
Shouldn't this be expanded over all formatter types?
Comment #4
Jelle_SRe-uploading. Somehow our build server is getting a 403 unauthorized on the patch above.
Comment #6
poker10 CreditAttribution: poker10 at ActivIT s.r.o. commentedNo, because all other formatters fills the
$element
array in foreach cycles, therefore it is populated only if$items
is not an empty array. This one formatter does populate the$element
array directly without the check.See:
vs:
I think the patch is correct. Committed this, thanks all!