tdoescher/googlemaps-bundle
Composer 安装命令:
composer require tdoescher/googlemaps-bundle
包简介
Content Element für Google Maps Embed API oder HTML-Code
README 文档
README
Contao 5 Bundle zur Einbindung von Google Maps als Content-Element. Es stehen zwei Element-Typen zur Verfügung:
- Google Maps Embed – Einbindung per iFrame via Google Maps Embed API (API-Key erforderlich)
- Google Maps HTML – Ausgabe von benutzerdefiniertem HTML-Code der Google Maps JavaScript API
Content-Elemente
Google Maps Embed (googlemaps_embed)
Bettet eine Google Maps Karte per iFrame ein. Die Karte wird über die Google Maps Embed API geladen.
Felder:
| Feld | Beschreibung | Pflichtfeld |
|---|---|---|
googlemaps_title |
Titel des iFrame (Barrierefreiheit) | Nein |
googlemaps_apikey |
Google Maps API-Key | Ja |
googlemaps_zoom |
Zoom-Stufe (Standard: 16) | Ja |
googlemaps_address |
Adresse oder Ortsbezeichnung | Ja |
Im Backend wird die eingetragene Adresse als Vorschau angezeigt.
Google Maps HTML (googlemaps_html)
Gibt benutzerdefiniertes HTML aus, das z. B. über die Google Maps JavaScript API erzeugt wurde. Der Code wird direkt aus dem Feld unfilteredHtml ausgegeben.
Im Backend wird ein statischer Platzhaltertext angezeigt.
CSP-Konfiguration
Die Templates setzen automatisch die erforderlichen Content Security Policy Header:
Embed-Element:
frame-src https://www.google.com
HTML-Element:
connect-src https://*.google.com,https://*.googleapis.com,https://*.gstatic.comfont-src https://fonts.gstatic.comimg-src https://*.google.com,https://*.googleapis.com,https://*.googleusercontent.com,https://*.gstatic.comscript-src https://*.google.com,https://*.googleapis.comstyle-src 'unsafe-inline' https://fonts.googleapis.com
Template-Anpassung
Die Twig-Templates befinden sich unter contao/templates/content_element/ und können wie bei Contao üblich überschrieben werden:
googlemaps_embed.html.twiggooglemaps_html.html.twig
Beide Templates erweitern @Contao/content_element/_base.html.twig und verwenden responsive Container mit BEM-Klassen:
.content-googlemaps-embed__container
.content-googlemaps-embed__responsive
.content-googlemaps-html__container
.content-googlemaps-html__responsive
tdoescher/googlemaps-bundle 适用场景与选型建议
tdoescher/googlemaps-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 4.85k 次下载、GitHub Stars 达 2, 最近一次更新时间为 2021 年 10 月 12 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 tdoescher/googlemaps-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 tdoescher/googlemaps-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 4.85k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 23
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: LGPL-3.0-or-later
- 更新时间: 2021-10-12