diff --git a/source/php/Component/OpenStreetMap/OpenStreetMap.php b/source/php/Component/OpenStreetMap/OpenStreetMap.php index cb1e2987..17b46753 100644 --- a/source/php/Component/OpenStreetMap/OpenStreetMap.php +++ b/source/php/Component/OpenStreetMap/OpenStreetMap.php @@ -21,6 +21,19 @@ public function init() foreach ($pins as &$pin) { $pin['lat'] = strval($pin['lat']); $pin['lng'] = strval($pin['lng']); + + if (isset($pin['tooltip']) && is_array($pin['tooltip'])) { + $pin['tooltip'] = array_filter($pin['tooltip'], function($x) { + if (is_array($x)) { + return !empty(array_filter($x)); + } + return !empty($x); + }); + + if (empty($pin['tooltip'])) { + unset($pin['tooltip']); + } + } } $this->data['attributeList']['data-js-map-pin-data'] = json_encode($pins, JSON_UNESCAPED_UNICODE);