Geofield Map Formatter cannot be added as Layout Builder block preview

Created on 3 September 2024, 4 months ago
Updated 13 September 2024, 3 months ago

Problem/Motivation

When placing a field as a block and use the Geofield Google Map formatter in layout builder, the entity has no ID so it will return NULL and crash into a fatal error when placing the field.

      // Generate GeoJsonData Feature.
      $info_window_description = $description[$delta] ?? (!empty($description) ? $description[0] : NULL);
      $feature = $this->getGeoJsonData($item, $entity->id(), $info_window_description, $tooltip);

Just a simple test to ignore if there is no idea, let the block being placed and render properly on the frontend where the entity ID is defined.

      // Generate GeoJsonData Feature.
      $info_window_description = $description[$delta] ?? (!empty($description) ? $description[0] : NULL);
      if (empty($entity->id())) {
        continue;
      }
      $feature = $this->getGeoJsonData($item, $entity->id(), $info_window_description, $tooltip);

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Fixed

Version

11.0

Component

Code

Created by

🇨🇦Canada phjou Vancouver 🇨🇦 🇪🇺

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

Comments & Activities

Production build 0.71.5 2024