Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

infoWindow does not show up #28

Open
chrisvel opened this issue Dec 24, 2012 · 2 comments
Open

infoWindow does not show up #28

chrisvel opened this issue Dec 24, 2012 · 2 comments

Comments

@chrisvel
Copy link

I did everything to make infoWindow show up but failed. I have set $this->setShowInfoWindowsForMarkers(true); but both true and false do nothing. Does anyone has any idea what might be the fault ?

@john2103
Copy link

john2103 commented Jan 4, 2013

Try this:

class allShopsMap extends Map
{
/**
* Constructs a new instance of LocationMap.
*/
public function __construct(EntityManager $em, $infoWindowBuilder)
{
parent::__construct();

    // configure your map in the constructor 
    // by setting the options

    $this->setShowZoomControl(true);
    $this->setZoom(13);
    $this->setAutoZoom(false);
    $this->setContainerId('map_canvas');
    $this->setWidth(980);
    $this->setHeight(360);
    $this->setShowInfoWindowsForMarkers(true);
    $this->setCenter(23.232323,23.232323);
    $this->setShowMapTypeControl(true);

    $query = $em->createQuery("SELECT st
                   FROM acme\ShopBundle\Entity\Shop sh 
                   WHERE sh.published = 1 ");
    $shops = $query->getResult();

    foreach ($shops as $shop) {
        $marker = new MapMarker($shop->getLatitude(), $shop->getLongitude(),$icon='images/map_marker.png');
        $marker->setInfoWindow($infoWindowBuilder->build($marker)); 
        $this->addMarker($marker);
    }
}

}

infoWindowBuilder is vich_geographical.info_window_builder service that is available in the container.

And modify your config :

services:
msgr.map.allShops:
class: msgr\ShopBundle\Map\allShopsMap
tags:
- { name: vichgeo.map, alias: allShops }
arguments:
entityManager: "@doctrine.orm.entity_manager"
infoWindowBuilder: "@vich_geographical.info_window_builder"

@chrisvel
Copy link
Author

chrisvel commented Jan 4, 2013

This works but it should be included in the readme. I think it's critical for people to know.
The problem with your solution is that the popups do not close automatically. Do we need to add something else in order to make it work fully and not partially ?

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants