Using the Openlayers formatter on a Geofield (provided by the openlayers_geofield module), the field label is shown on a rendered entity even when the geofield value is empty.

So for instance, I have a Geofield titled "Geometry". When that field is left blank, and the entity is saved, the word "Geometry:" still appears in the rendered entity, with nothing else (no map).

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

m.stenta created an issue. See original summary.

m.stenta’s picture

Status: Active » Needs review
FileSize
564 bytes

Here is a very simple patch to the openlayers_geofield field formatter function (openlayers_geofield_field_formatter_view()) which detects if there are no values, and returns an empty element, instead of continuing to build the field output.

Pol’s picture

Hi there,

Seems good for me :)

  • m.stenta committed ead77cb on 7.x-3.x
    Issue #2880034 by m.stenta: Geofield label shows for empty fields
    
m.stenta’s picture

Status: Needs review » Fixed

Thanks for reviewing @Pol! I committed this.

Status: Fixed » Closed (fixed)

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