public function map($locations, $config = array())
    {
        if($locations instanceof ComLocationsDomainEntityLocation){
            $locations = array($locations);
        }

        $data = array();

        foreach($locations as $location){
            $data[] = array(
                'longitude' => $location->longitude,
                'latitude' => $location->latitude,
                'name' => $location->name,
                'url' => route($location->getURL())
            );
        }

        $config['locations'] = htmlspecialchars(json_encode($data), ENT_QUOTES);
        $config['service'] = get_config_value('locations.service', 'google');

        return $this->_render('map_'.$config['service'], $config);
    }
public function map($locations, $config = array())
    {
        if($locations instanceof ComLocationsDomainEntityLocation){
            $locations = array($locations);
        }

        $data = array();

        foreach($locations as $location){
            $data[] = array(
                'longitude' => $location->longitude,
                'latitude' => $location->latitude,
                'name' => $location->name,
                'url' => route($location->getURL())
            );
        }

        $config['locations'] = htmlspecialchars(json_encode($data), ENT_QUOTES);
        $config['service'] = get_config_value('locations.service', 'google');

        return $this->_render('map_'.$config['service'], $config);
    }
public function map ( $ locations , $ config = array ( ) ) { if ( $ locations instanceof ComLocationsDomainEntityLocation ) { $ locations = array ( $ locations ) ; } $ data = array ( ) ; foreach ( $ locations as $ location ) { $ data [ ] = array ( 'longitude' => $ location -> longitude , 'latitude' => $ location -> latitude , 'name' => $ location -> name , 'url' => route ( $ location -> getURL ( ) ) ) ; } $ config [ 'locations' ] = htmlspecialchars ( json_encode ( $ data ) , ENT_QUOTES ) ; $ config [ 'service' ] = get_config_value ( 'locations.service' , 'google' ) ; return $ this -> _render ( 'map_' . $ config [ 'service' ] , $ config ) ; }
renders a map

@param array of ComLocationsDomainEntityLocation entities
@param array of configuration params: longitude, latitude, name, url

@return string html
renders a map