示例#1
0
 /**
  * Render map
  *
  * @param Map $map
  *
  * @return mixed
  */
 public function renderMap(Map $map) : array
 {
     $mapHelper = new MapHelper();
     $jsMap = $mapHelper->renderJsLibraries($map);
     $jsMap = $this->removeJsCaller($jsMap);
     $jsMap .= '<script type="text/javascript"> function load_ivory_google_map(){' . $mapHelper->renderJsContainer($map) . '}</script>';
     return ['html' => $mapHelper->renderHtmlContainer($map) . $mapHelper->renderStylesheets($map), 'js' => $jsMap];
 }
    public function testRenderStylesheets()
    {
        $map = new Map();
        $map->setHtmlContainerId('html_container_id');
        $map->setStylesheetOptions(array('width' => '200px', 'height' => '100px', 'option1' => 'value1'));
        $expected = <<<EOF
<style type="text/css">
#html_container_id{
width:200px;
height:100px;
option1:value1;
}
</style>

EOF;
        $this->assertSame($expected, $this->mapHelper->renderStylesheets($map));
    }
 /**
  * Renders the google map stylesheets.
  *
  * @param \Ivory\GoogleMap\Map $map The map.
  *
  * @return string The html output.
  */
 public function renderStylesheets(Map $map)
 {
     return $this->mapHelper->renderStylesheets($map);
 }