Closed ALacroix68 closed 7 years ago
Hello @egeloen,
I'm using Ivory Google maps with Symfony. But I have an error when rendering the map : ReferenceError: google is not defined
My code PHP : `
$map = new Map(); $map->setStylesheetOptions([ 'width' => '100%', 'height' => '500px' ]);
`
Twig : {{ map(gmap) }} {{ map_js(gmap) }}
{{ map(gmap) }} {{ map_js(gmap) }}
With this code in TwigExtension :
public function getFunctions() { return array( 'map' => new \Twig_SimpleFunction('map', [$this, 'renderGoogleMap']), 'map_js' => new \Twig_SimpleFunction('map_js', [$this, 'renderGoogleMapJs']), ); } public function renderGoogleMap(Map $map){ return $this->getMapHelper()->renderHtml($map); } public function renderGoogleMapJs(Map $map){ return $this->getMapHelper()->renderJavascript($map); } /** * @return MapHelper */ protected function getMapHelper(){ if($this->mapHelper === NULL){ $mapHelperBuilder = MapHelperBuilder::create(); $this->mapHelper = $mapHelperBuilder->build(); } return $this->mapHelper; }
What's wrong in my code ?
Thanks in advance, AL
Hello @egeloen,
I'm using Ivory Google maps with Symfony. But I have an error when rendering the map : ReferenceError: google is not defined
My code PHP : `
`
Twig :
{{ map(gmap) }} {{ map_js(gmap) }}
With this code in TwigExtension :
What's wrong in my code ?
Thanks in advance, AL