weareknit/silverstripe-admin-google-map
Composer 安装命令:
composer require weareknit/silverstripe-admin-google-map
包简介
Display a Google Map in the Silverstripe CMS admin to set latitude and longitude data.
README 文档
README
This is a very basic module for getting a Google Map into the Silverstripe CMS.
It provides a map with a draggable pin that, upon being moved, updates latitude and longitude CMS fields.
##Installation
Simply download a copy of this repo, or add it as a submodule via git, to the root of your SilverStripe installation.
Add the following line to your site's _config.php (with your Google Map key):
define("GOOGLE_MAP_KEY", "your_key");
Don't forget to run dev/build?flush=all
##Basic Usage
By default, the module will expect the following situation
-
There will be fields with the IDs Form_ItemEditForm_Lat and Form_ItemEditForm_Lng (fields with the names Lat and Lng will have these IDs given to them by SilverStripe).
-
These fields will be in a CMS tab with the ID of Root_Location
You would then simply need to create a GoogleMapField, giving it a name as you would with a SilverStripe field, for example:
public function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldsToTab("Root.Location", array(
// Create hidden latitude field
HiddenField::create("Lat"),
// Create hidden longitude field
HiddenField::create("Lng"),
// Create Google map field
GoogleMapField::create("Map", array(
// Override any default options
))
));
return $fields;
}
##Address geolocation
You can optionally add a text field that allows the user to search for a location. A button is provided for the user to click and update the map.
##Options
If your situation isn't the same as above, you can provide any of the following options to suit your setup.
These options can be passed as key => value pairs as the second argument of the GoogleMapField function. These options and their default values are:
$googleMapField = GoogleMapField::create("Map", array(
"height" => "500px", // The height of the map element
"heading" => "", // A heading in a <h4> tag to appear before the map
"lng_field" => "Form_ItemEditForm_Lng", // The ID of the longitude input element
"lat_field" => "Form_ItemEditForm_Lat", // The ID of the latitude input element
"tab" => "Root_Location", // The ID of the tab that the map is in
"address_field" => "Address", // The ID of the address field (if it exists)
"map_zoom" => 10, // The initial zoom level of the map
"start_lat" => "51.508515", // The initial latitude of the map marker
"start_lng" => "-0.125487" // The initial longitude of the map marker
));
weareknit/silverstripe-admin-google-map 适用场景与选型建议
weareknit/silverstripe-admin-google-map 是一款 基于 JavaScript 开发的 Composer 扩展包,目前已累计 2.17k 次下载、GitHub Stars 达 5, 最近一次更新时间为 2015 年 01 月 31 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「admin」 「cms」 「map」 「google」 「silverstripe」 「latitude」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 weareknit/silverstripe-admin-google-map 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 weareknit/silverstripe-admin-google-map 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 weareknit/silverstripe-admin-google-map 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Maps in minutes. Powered by the Google Maps API.
Yii2 map input widget. Allows you to select geographcal coordinates via a human-friendly inteface.
2lenet/EasyAdminPlusBundle
GraphQL authentication for your headless Craft CMS applications.
Set Links with a specific language parameter
Supercharged text field validation.
统计信息
- 总下载量: 2.17k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 5
- 点击次数: 15
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2015-01-31
