Hello,

When the debug is active, leaflet_process_geofield() is trigerred a second time on views with a Markup object in the $items and it causes a fatal error.

Error: Cannot use object of type Drupal\Core\Render\Markup as array in leaflet_process_geofield() (line 141 of modules/contrib/leaflet/leaflet.module).

I will upload a patch.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Grimreaper created an issue. See original summary.

Grimreaper’s picture

Assigned: Grimreaper » Unassigned
Status: Active » Needs review
FileSize
952 bytes

Here is the patch.

Thanks for the review.

MaskOta’s picture

Status: Needs review » Reviewed & tested by the community

I can confirm this problem and that this patch solves it.

Thanks

MaskOta’s picture

Status: Reviewed & tested by the community » Needs work

I was too quick to judge.

The patch makes the error go away but then the geo point doesn't get processed.

I did something like this so the map shows properly:

if (!is_object($item)) {
      if (!($geom = geoPHP::load(isset($item['wkt']) ? $item['wkt'] : $item))) {
        continue;
      }
    }
    else {
      if (!($geom = geoPHP::load(isset($item->string) ? $item->string : $item))) {
        continue;
      }
    }
jviitamaki’s picture

I couldn't replicate the problem mentioned in #4 and the first patch works properly.

When the item is of type Drupal\Core\Render\Markup only value it holds is the twig debug information therefore it's kind of useless to try to run in through geoPHP.

I refactored the patch to not include everything on one line and some added some comments for better readability.

jviitamaki’s picture

Status: Needs work » Needs review
FMB’s picture

Status: Needs review » Reviewed & tested by the community

#5 patch solved the issue, thanks.

Jerenus’s picture

#5 works for me.

friera’s picture

#5 works for me.

proweb.ua’s picture

#5 works

FMB’s picture

The Leaflet module no longer has a leaflet_process_geofield() function, I guess we should close this issue?

itamair’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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