cethyworks / google-map-display-bundle
Provides a way to display google maps from address(es) (w/ the javascript API), the most minimalist, unobtrusive way possible.
Installs: 291
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Type:symfony-bundle
pkg:composer/cethyworks/google-map-display-bundle
Requires
- php: >=5.6.17
 - cethyworks/content-injector-bundle: ^2.0
 - symfony/config: ^3.3
 - symfony/dependency-injection: ^3.3
 - twig/twig: ^1.0||^2.0
 
Requires (Dev)
- phpunit/phpunit: ^4.8
 - symfony/asset: ^3.3
 - symfony/event-dispatcher: ^3.3
 - symfony/framework-bundle: ~2.7|~3.0|~4.0
 - symfony/http-foundation: ^3.3
 - symfony/http-kernel: ^3.3
 - symfony/templating: ^3.3
 - symfony/translation: ^3.3
 - symfony/twig-bundle: ^3.3
 - symfony/validator: ^3.3
 
This package is not auto-updated.
Last update: 2024-11-19 17:19:05 UTC
README
Provides a way to display google maps from address(es) (w/ the javascript API), the most minimalist, unobtrusive way possible.
Install
1. Composer require
$ composer require cethyworks/google-map-display-bundle 
2. Register bundles
// AppKernel.php
class AppKernel extends Kernel
{
    public function registerBundles()
    {
        $bundles = [
            // ...
            new Cethyworks\ContentInjectorBundle\CethyworksContentInjectorBundle(),
            new Cethyworks\GooglePlaceAutocompleteBundle\CethyworksGooglePlaceAutocompleteBundle(),
        ];
        // ...
How to use
1. Update (optionally) your config.yml with :
cethyworks_google_map_display:
    google:
        api_key: 'your_api_key'
2. Call the handler to add maps :
// retrieve the command handler
/** @var GoogleMapDisplayCommandHandler $handler */
$commandHandler = $container->get(GoogleMapDisplayCommandHandler::class);
// add address & html id to display the map
$commandHandler->addMap('map_id', 'address 1');
// optionnally add other maps 
// $commandHandler->addMap('map2', 'address 2');
// ...
4. Done ! (the handler register automatically the Command)
How it works
The ContentInjectorSubscriber will inject the template containing the javascript code (with mapIds, addresses & the google api_key) into the Response automatically.