heimrichhannot / contao-google-maps-bundle
This bundle adds google maps integration to Contao.
Installs: 3 787
Dependents: 1
Suggesters: 1
Security: 0
Stars: 3
Watchers: 6
Forks: 9
Open Issues: 1
Type:contao-bundle
pkg:composer/heimrichhannot/contao-google-maps-bundle
Requires
- php: ^8.1
- contao/core-bundle: ^5.3
- doctrine/dbal: ^3.6 || ^4.0
- heimrichhannot/contao-utils-bundle: ^3.6
- ivory/google-map: ^6.0
- mvo/contao-group-widget: ^1.5
- symfony/config: ^6.4
- symfony/console: ^6.4
- symfony/dependency-injection: ^6.4
- symfony/event-dispatcher: ^6.4
- symfony/http-foundation: ^6.4
- symfony/http-kernel: ^6.4
- twig/twig: ^3.15
Requires (Dev)
- contao/easy-coding-standard: ^6.0
- contao/manager-plugin: ^2.0
- guzzlehttp/guzzle: ^7.9
- hofff/contao-consent-bridge: ^1.4
Conflicts
- hofff/contao-consent-bridge: <1.4 || >=2.0
- ivory/google-map: <3.0.4
- v3.x-dev
- 3.0.0-beta2
- 3.0.0-beta1
- v2.x-dev
- 2.11.2
- 2.11.1
- 2.11.0
- 2.10.2
- 2.10.1
- 2.10.0
- 2.9.0
- 2.8.2
- 2.8.1
- 2.8.0
- 2.7.1
- 2.7.0
- 2.6.0
- 2.5.2
- 2.5.1
- 2.5.0
- 2.4.0
- 2.3.0
- 2.2.2
- 2.2.1
- 2.2.0
- 2.1.1
- 2.1.0
- 2.0.0
- 2.0.0-beta16
- 2.0.0-beta15
- 2.0.0-beta14
- 2.0.0-beta13
- 2.0.0-beta12
- 2.0.0-beta11
- 2.0.0-beta10
- 2.0.0-beta9
- 2.0.0-beta8
- 2.0.0-beta7
- 2.0.0-beta6
- 2.0.0-beta5
- 2.0.0-beta4
- 2.0.0-beta3
- 2.0.0-beta2
- 2.0.0-beta1
- v1.x-dev
- 1.4.1
- 1.4.0
- 1.3.2
- 1.3.1
- 1.3.0
- 1.2.5
- 1.2.4
- 1.2.3
- 1.2.2
- 1.2.1
- 1.2.0
- 1.1.0
- 1.0.2
- 1.0.1
- 1.0.0
- 0.3.0
- 0.2.0
- 0.1.1
- 0.1.0
- 0.0.9
- 0.0.8
- 0.0.7
- 0.0.6
- 0.0.5
- 0.0.4
- 0.0.3
- 0.0.2
- 0.0.1
This package is auto-updated.
Last update: 2026-02-02 16:15:13 UTC
README
This bundle adds google maps integration to Contao. It's based on ivory/google-map.
Features
- introduces a simple Contao backend entity to configure your Google Map and overlays (markers, info windows, ...)
- frontend module and content element
- insert tag and twig function
- easy contao command based migration tool for delahaye/dlh_googlemaps (courtesy to delahaye!)
- responsive support (mobile first), provide responsive configurations that will update the map upon reaching the value (greater than breakpoint)
- support for hofff/contao-consent-bridge
- support for Oveleon Cookiebar
Setup and usage
Setup
-
Install with contao manager or composer and update database afterwards
composer require heimrichhannot/contao-google-maps-bundle -
Optional: If you have already google maps created with delahaye/dlh_googlemaps refer to the section "Migrating from dlh_googlemaps".
-
Set your Google API key (capable of Google Maps and Google Static Maps) if not already done in one of the following places (ascending priority):
- global Contao settings (
tl_settings) - page root (
tl_page) - Google Maps config (
tl_google_map)
- global Contao settings (
Usage
- Create a Google Map using the corresponding menu entry in Contao on the left.
- Optional: create markers with the created google map configuration (markers are child entities of a map)
- Now you can integrate the map in your website using one of the following build-in ways:
- Content element
- Module
- Insert tag (see below)
- Twig function (see below)
Twig
To render your map in a twig template, use google_map_create:
{# The shortest way: #} {{ google_map(2) }} {# There are more possiblities: #} {% set map = google_map(2) .addOverlays(overlays) {# set overlays dynamically (pass as array|Collection<array|Model> #} .build() {# build the map, is needed before working with overlays/ markers #} %} {# Create link to trigger a marker (typically open info window #} <a href="#" onclick="{{ map.marker(overlays[1].id).trigger }}"> Trigger marker id {{ map.marker(overlays[1].id).variable }} </a> {# Render the map #} {{ map }} {# Or render only html, css or js #} {{ map.html }} {{ map.css }} {{ map.js }}
Migrating from dlh_googlemaps
Although we cannot guarantee to fully migrate your existing dlh_googlemaps instances, you will nevertheless have a point to start from. Think of it as a 95% migration ;-)
Migrating is as simple as running vendor/bin/contao-console huh:google-maps:migrate-dlh from your contao root dir. Your dlh google maps are not changed by this process, only new instances in tl_google_map and tl_google_map_overlay are created out of the existing legacy data.
Insert Tags
| Name | Arguments | Example |
|---|---|---|
| google_map | ID of the tl_google_map instance |
{{google_map::1}} |
| google_map_html | ID of the tl_google_map instance |
{{google_map_html::1}} |
| google_map_css | ID of the tl_google_map instance |
{{google_map_css::1}} |
| google_map_js | ID of the tl_google_map instance |
{{google_map_js::1}} |
TODO
- Overlay types:
- polyline
- circle
- rectangle
- ground_overlay