Popup content is blank on markers

Created on 24 July 2023, over 1 year ago
Updated 2 August 2023, over 1 year ago

Problem/Motivation

I am generating an array of map markers on a custom form. All the markers appear in the correct places, and a popup appears when the marker is clicked, however, I just get an empty (blank) popup. This worked in a previous version of leaflet (sorry I don't know which exact version). Can anyone tell me what might have changed and how I should alter my code? Here's how I'm adding to the $points array:

$points[] = array(
				'type' => 'point',
				'lat' => $lat,
				'lon' => $lng,
				'popup' => '<p><span class="map-data-type">'.$program_name.'</span><br />'.$plink.'<br />'.$author_name.'</p>',
				'leaflet_id' => 'point-' . $n->id(). '-' . $lat,
				'icon' => array(
        			'iconUrl' => '/' . drupal_get_path('theme', 'graham_bootstrap') . '/images/pinpoint_10.png',
					'iconSize' => array('x' => 10, 'y' => 10),
					'iconAnchor' => array('x' => 10, 'y' => 10),
					'popupAnchor' => array('x' => -5, 'y' => -10),
				),
			);

I can confirm that the string I'm generating in the 'popup' array key is a nice, valid string. Line 167 of leaflet.api.php shows "- popup: This value is displayed in a popup after the user clicks on the feature." Does anything stick out? TIA.

💬 Support request
Status

Fixed

Version

10.0

Component

Miscellaneous

Created by

🇺🇸United States dmudie

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

Comments & Activities

  • Issue created by @dmudie
  • Status changed to Fixed over 1 year ago
  • 🇮🇹Italy itamair

    In the new 10.x version of the Leaflet module the "pop" property should be an array with the following properties:

    ...
    'popup' => [
       "content" => "", // this is never used, and kept only for Leaflet 2.x backward compatibilities ... 
       "control" => "1", 
       "options" => "{"maxWidth":"300","minWidth":"50","autoPan":true}", 
       "value" => "830 5th Ave, 10065 New York USA" // this is the real value rendered in the Pop InfoWindow, could also be HTML markup ... 
    ],
    ...

    Hope this helps and solves this Support Request. Feel free to review and reopen if still not ok with this answer.

  • 🇺🇸United States dmudie

    Thanks a ton @itamair. Works perfectly.

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

Production build 0.71.5 2024