/** * Renders the javascript container marker shapes. * * @param \Ivory\GoogleMap\Map $map The map. * * @return string The JS output. */ public function renderJsContainerMarkerShapes(Map $map) { $output = array(); foreach ($this->computeMarkerShapes($map) as $markerShape) { $output[] = sprintf('%s.marker_shapes.%s = %s', $this->getJsContainerName($map), $markerShape->getJavascriptVariable(), $this->markerShapeHelper->render($markerShape)); } return implode('', $output); }
public function testRenderWithRectangleType() { $markerShape = new MarkerShape('rect', array(-1, -1, 1, 1)); $markerShape->setJavascriptVariable('markerShape'); $this->assertSame('markerShape = new google.maps.MarkerShape({"type":"rect","coords":[-1,-1,1,1]});' . PHP_EOL, $this->markerShapeHelper->render($markerShape)); }