{"id":20961844,"url":"https://github.com/heimrichhannot/contao-google-maps-bundle","last_synced_at":"2025-05-14T07:31:09.751Z","repository":{"id":31136721,"uuid":"126998543","full_name":"heimrichhannot/contao-google-maps-bundle","owner":"heimrichhannot","description":"This bundle adds google maps integration to Contao.","archived":false,"fork":false,"pushed_at":"2025-03-24T14:11:09.000Z","size":285,"stargazers_count":2,"open_issues_count":4,"forks_count":8,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-29T15:36:28.990Z","etag":null,"topics":["contao","googlemaps"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/heimrichhannot.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-03-27T14:23:04.000Z","updated_at":"2025-03-24T14:11:09.000Z","dependencies_parsed_at":"2024-04-30T11:12:11.392Z","dependency_job_id":null,"html_url":"https://github.com/heimrichhannot/contao-google-maps-bundle","commit_stats":{"total_commits":124,"total_committers":15,"mean_commits":8.266666666666667,"dds":0.6129032258064516,"last_synced_commit":"e27fe5639520fc878618a211a5404ae366806599"},"previous_names":[],"tags_count":66,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heimrichhannot%2Fcontao-google-maps-bundle","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heimrichhannot%2Fcontao-google-maps-bundle/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heimrichhannot%2Fcontao-google-maps-bundle/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heimrichhannot%2Fcontao-google-maps-bundle/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/heimrichhannot","download_url":"https://codeload.github.com/heimrichhannot/contao-google-maps-bundle/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254094863,"owners_count":22013650,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["contao","googlemaps"],"created_at":"2024-11-19T02:17:53.126Z","updated_at":"2025-05-14T07:31:05.760Z","avatar_url":"https://github.com/heimrichhannot.png","language":"PHP","readme":"# Contao Google Maps Bundle\n\n![](https://img.shields.io/packagist/v/heimrichhannot/contao-google-maps-bundle.svg)\n![](https://img.shields.io/packagist/dt/heimrichhannot/contao-google-maps-bundle.svg)\n\nThis bundle adds google maps integration to [Contao](https://contao.org/de/). It's based on [ivory/google-map](https://github.com/bresam/ivory-google-map).\n\n## Features\n\n- introduces a simple Contao backend entity to configure your Google Map and overlays (markers, info windows, ...)\n- frontend module and content element\n- insert tag and twig function\n- easy contao command based migration tool for [delahaye/dlh_googlemaps](https://github.com/delahaye/dlh_googlemaps) (courtesy to delahaye!)\n- responsive support (mobile first), provide responsive configurations that will update the map upon reaching the value (greater than breakpoint)\n- support for [List bundle](https://github.com/heimrichhannot/contao-list-bundle) and [Reader bundle](https://github.com/heimrichhannot/contao-reader-bundle)\n- support for [hofff/contao-consent-bridge](https://github.com/hofff/contao-consent-bridge)\n\n## Setup and usage\n\n### Setup\n\n1. Install with contao manager or composer and update database afterwards\n\n       composer require heimrichhannot/contao-google-maps-bundle\n\n2. Optional: If you have already google maps created with [delahaye/dlh_googlemaps](https://github.com/delahaye/dlh_googlemaps) refer to the section \"Migrating from dlh_googlemaps\".\n3. 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):\n    - global Contao settings (`tl_settings`)\n    - page root (`tl_page`)\n    - Google Maps config (`tl_google_map`)\n\n### Usage\n\n1. Create a Google Map using the corresponding menu entry in Contao on the left.\n2. Optional: create markers with the created google map configuration (markers are child entities of a map)\n4. Now you can integrate the map in your website using one of the following build-in ways:\n    - Content element\n    - Module\n    - Insert tag (see below)\n    - Twig function (see below)\n    - render a list as map, list config element or reader config element\n\n#### List and reader bundle\n\nFor both list and reader bundle a config element is provided to add maps to the items.\n\nFor lists you also get the option to render the complete list as map. \nIn your list configuration, check the `renderItemsAsMap` option and do the additional configuration.\nYou can use or adapt the bundled default template: `list_google_maps_default.html.twig` and `list_item_google_maps_default.html.twig`.\n\nTypical, your list items don't have the correct fields added and filled to be used as markers on a maps.\nSo you need to implement an event listener for the `GoogleMapsPrepareExternalItemEvent` \nand create or update an overlay object that can be displayed on the map.\n\n```php\nclass GoogleMapsSubscriber implements EventSubscriberInterface {\n\n    public static function getSubscribedEvents() {\n        return [GoogleMapsPrepareExternalItemEvent::class =\u003e 'onGoogleMapsPrepareExternalItemEvent',];\n    }\n\n    public function onGoogleMapsPrepareExternalItemEvent(GoogleMapsPrepareExternalItemEvent $event): void\n    {\n        if (!$event-\u003egetConfigModel() instanceof ListConfigModel) {\n            return;\n        }\n        \n        $item = (object)$event-\u003egetItemData();\n        \n        $overlay = new OverlayModel();\n        $overlay-\u003etitle = $item-\u003eheadline;\n        $overlay-\u003etype = Overlay::TYPE_MARKER;\n        if ($item-\u003ecoordX \u0026\u0026 $item-\u003ecoordX) {\n            $overlay-\u003epositioningMode = Overlay::POSITIONING_MODE_COORDINATE;\n            $overlay-\u003epositioningLat = trim($item-\u003ecoordX);\n            $overlay-\u003epositioningLng = trim($item-\u003ecoordX);\n        } elseif (!empty($item-\u003eaddress)) {\n            $overlay-\u003epositioningMode = Overlay::POSITIONING_MODE_STATIC_ADDRESS;\n            $overlay-\u003epositioningAddress = $item-\u003eaddress;\n        } else {\n            $event-\u003esetOverlayModel(null);\n            return;\n        }\n        $overlay-\u003emarkerType = Overlay::MARKER_TYPE_SIMPLE;\n        $overlay-\u003eclickEvent = Overlay::CLICK_EVENT_INFO_WINDOW;\n        $overlay-\u003einfoWindowText = '\u003cp\u003e\u003cb\u003e'.$item-\u003eheadline.'\u003c/b\u003e\u003c/p\u003e';\n        $overlay-\u003epublished='1';\n        $event-\u003esetOverlayModel($overlay);\n    }\n}\n```\n\n\n\n\n\n## Migrating from dlh_googlemaps\n\nAlthough 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 ;-)\n\nMigrating 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.\n\n## Insert Tags\n\nName | Arguments | Example\n---- | --------- | -------\ngoogle_map | ID of the `tl_google_map` instance | {{google_map::1}}\ngoogle_map_html | ID of the `tl_google_map` instance | {{google_map_html::1}}\ngoogle_map_css | ID of the `tl_google_map` instance | {{google_map_css::1}}\ngoogle_map_js | ID of the `tl_google_map` instance | {{google_map_js::1}}\n\n## Twig functions\n\nName | Arguments | Example\n---- | --------- | -------\ngoogle_map | ID of the `tl_google_map` instance | {{ google_map(1) }}\ngoogle_map_html | ID of the `tl_google_map` instance | {{ google_map_html(1) }}\ngoogle_map_css | ID of the `tl_google_map` instance | {{ google_map_css(1) }}\ngoogle_map_js | ID of the `tl_google_map` instance | {{ google_map_js(1) }}\n\n## TODO\n\n- Overlay types:\n    - polyline\n    - circle\n    - rectangle\n    - ground_overlay\n    \n## Documentation\n\n[Developer documentation](docs/developers.md)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fheimrichhannot%2Fcontao-google-maps-bundle","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fheimrichhannot%2Fcontao-google-maps-bundle","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fheimrichhannot%2Fcontao-google-maps-bundle/lists"}