igor-rinkovec / map-form-type-bundle
Symfony 3 通用的地图 FormType
1.2.1.1
2018-01-31 11:17 UTC
Requires
- php: ^7.1
- symfony/form: ^3.0
- symfony/framework-bundle: ^3.0
- symfony/security-bundle: ^3.0
- twig/twig: ^2.0
Requires (Dev)
- phpunit/phpunit: ~4.8|~5.0
- symfony/console: ^3.3
- symfony/phpunit-bridge: ^3.3
This package is not auto-updated.
Last update: 2024-09-23 14:28:24 UTC
README
Symfony 3 和 Sonata Project 通用的地图 FormType。
使用 Leaflet 在表单上设置纬度、经度和来自 Nominatim 的任何其他值。支持配置后备图层、基础图层和叠加图层。当拖动标记或填写地址时,字段将更新。
安装
1) 安装先决条件
确保包含 bootstrap 样式和脚本。
注意:当使用 bootstrap v4 时,确保还包含 glyphicons。
2) 安装 Bundle
使用 composer 安装 Bundle
composer require curious-inc/map-form-type-bundle
3) 启用 Bundle
在 app/AppKernel.php 中注册 Bundle 以启用它
// app/AppKernel.php // ... class AppKernel extends Kernel { // ... public function registerBundles() { $bundles = [ // ... new CuriousInc\MapFormTypeBundle\CuriousIncMapFormTypeBundle(), ]; // ... } }
4) 配置 Bundle
将以下配置添加到 app/config/config.yml 并根据需要或愿望进行更改
curious_inc_map_form_type: ~
5) 配置 MapType 模板
将 MapType 模板添加到 app/config/config.yml 中的 twig,如下所示
# Twig Configuration twig: form_themes: - CuriousIncMapFormTypeBundle:Form:fields.html.twig