CakePHP-GoogleMapHelper icon indicating copy to clipboard operation
CakePHP-GoogleMapHelper copied to clipboard

Problem with 'markerTitle'

Open joaotokunaga opened this issue 8 years ago • 0 comments

The first example:

<?
  // Override any of the following default options to customize your map
  $map_options = array(
    'id' => 'map_canvas',
    'width' => '800px',
    'height' => '800px',
    'style' => '',
    'zoom' => 7,
    'type' => 'HYBRID',
    'custom' => null,
    'localize' => true,
    'latitude' => 40.69847032728747,
    'longitude' => -1.9514422416687,
    'address' => '1 Infinite Loop, Cupertino',
    'marker' => true,
    'markerTitle' => 'This is my position',
    'markerIcon' => 'http://google-maps-icons.googlecode.com/files/home.png',
    'markerShadow' => 'http://google-maps-icons.googlecode.com/files/shadow.png',
    'infoWindow' => true,
    'windowText' => 'My Position',
    'draggableMarker' => false
  );
?>

<?= $this->GoogleMap->map($map_options); ?>

If you use a full URL in 'markerIcon' (starting with HTTP://), it works fine, but if I try to use something from my webroot image repository (something like $this->Url->image('image.png')), I get an error. This happens in CakePHP 3.5 because there's an unidentified variable 'IMAGES_URL' in GoogleMapHelper.php

I tried to manually set IMAGES_URL to '/img' but it wasn't working either.

My solution was to completely remove this constant and let me set the image URL manually, but you guys might find a different (and better) solution for this.

joaotokunaga avatar Jan 23 '18 02:01 joaotokunaga