2017 © Pedro Peláez
 

contao-bundle contao-leaflet-geocode-widget

Geocode widget based on Leaflet

image

netzmacht/contao-leaflet-geocode-widget

Geocode widget based on Leaflet

  • Friday, February 23, 2018
  • by netzmacht
  • Repository
  • 1 Watchers
  • 0 Stars
  • 530 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 7 Versions
  • 11 % Grown

The README.md

Leaflet geocode widget

Build Status Version License Downloads, (*1)

This extension provides a widget to pick coordinates from a map. It uses the leaflet framework., (*2)

Changlog

See CHANGELOG., (*3)

Requirements

  • Contao ^4.13||^5.0
  • PHP ^7.4||^8.0

Install

1. Install using composer

php composer.phar require netzmacht/contao-leaflet-geocode-widget

2. Update your AppKernel.php

git If you use the managed edition of Contao you can skip this step., (*4)


// Dependency is automatically installed and has to be registered new Contao\CoreBundle\HttpKernel\Bundle\ContaoModuleBundle('leaflet-libs', $this->getRootDir()), // Register the bundle new Netzmacht\Contao\Leaflet\GeocodeWidget\LeafletGeocodeWidgetBundle(),

3. Update the assets

bin/console assets:install --symlink

4. Use the widget

Coordinates only

$GLOBALS['TL_DCA']['tl_example']['fields']['coordinates'] = [
    'label'     => ['Koordinaten', 'Geben Sie die Koordinaten ein'],
    'inputType' => 'leaflet_geocode',
    'eval'      => [
        'tl_class' => 'w50',
    ],
    'sql' => 'varchar(255) NOT NULL default \'\''
];

Coordinates and radius

To pick the radius in meters as well, you have to configure the eval.radius option for the related radius field. The radius field should be a simle text input. The default, minval and maxval flags are passed to the geocode widget so that only radius in that boundary can be chosen., (*5)

$GLOBALS['TL_DCA']['tl_page']['fields']['coordinates'] = [
    'label'     => ['Koordinaten', 'Geben Sie die Koordinaten ein'],
    'inputType' => 'leaflet_geocode',
    'eval'      => [
        'tl_class' => 'w50',
        'radius'   => 'radius'
    ],
    'sql' => 'varchar(255) NOT NULL default \'\''
];

$GLOBALS['TL_DCA']['tl_page']['fields']['radius'] = [
    'label'     => ['Radius', 'Angabe des Radius in Metern'],
    'inputType' => 'leaflet_radius', // Optional, you can use a text widget as well
    'eval'      => [
        'default'  => 500,
        'minval'   => 100,
        'maxval'   => 5000,
        'steps'    => 100, // Round value to the closest 100m.
        'tl_class' => 'w50',
    ],
    'sql' => 'varchar(255) NOT NULL default \'\''
];

If you want to add an wizard icon to the radius field as well, you only have to reference the coordinates field., (*6)

$GLOBALS['TL_DCA']['tl_page']['fields']['radius'] = [
    'label'     => ['Radius', 'Angabe des Radius in Metern'],
    'inputType' => 'leaflet_radius',
    'eval'      => [
        'rgxp'        => 'natural',
        'default'     => 500,
        'minval'      => 100,
        'maxval'      => 5000,
        'tl_class'    => 'w50 wizard',
        'coordinates' => 'coordinates'
    ],
    'sql' => 'varchar(255) NOT NULL default \'\''
];

The Versions

23/02 2018

dev-master

9999999-dev

Geocode widget based on Leaflet

  Sources   Download

LGPL-3.0+ LGPL-3.0-or-later

The Requires

 

The Development Requires

widget leaflet contao geocode

23/02 2018

dev-develop

dev-develop

Geocode widget based on Leaflet

  Sources   Download

LGPL-3.0-or-later

The Requires

 

The Development Requires

widget leaflet contao geocode

23/02 2018

1.3.0

1.3.0.0

Geocode widget based on Leaflet

  Sources   Download

LGPL-3.0-or-later

The Requires

 

The Development Requires

widget leaflet contao geocode

14/11 2017

1.2.1

1.2.1.0

Geocode widget based on Leaflet

  Sources   Download

LGPL-3.0+

The Requires

 

The Development Requires

widget leaflet contao geocode

13/11 2017

1.2.0

1.2.0.0

Geocode widget based on Leaflet

  Sources   Download

LGPL-3.0+

The Requires

 

The Development Requires

widget leaflet contao geocode

04/10 2017

1.1.0

1.1.0.0

Geocode widget based on Leaflet

  Sources   Download

LGPL-3.0+

The Requires

 

The Development Requires

widget leaflet contao geocode

26/01 2017

1.0.0

1.0.0.0

Geocode widget based on Leaflet

  Sources   Download

LGPL-3.0+

The Requires

 

The Development Requires

widget leaflet contao geocode