igor-rinkovec/map-form-type-bundle

Symfony 3 通用的地图 FormType

安装: 2

依赖者: 0

建议者: 0

安全: 0

星星: 0

关注者: 2

分支: 1

语言:JavaScript

类型:symfony-bundle

1.2.1.1 2018-01-31 11:17 UTC

README

Symfony 3 和 Sonata Project 通用的地图 FormType。

使用 Leaflet 在表单上设置纬度、经度和来自 Nominatim 的任何其他值。支持配置后备图层、基础图层和叠加图层。当拖动标记或填写地址时,字段将更新。

License: MIT

安装

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