From a4c24a80c27f99d91d369c445ea6b4d98c7313be Mon Sep 17 00:00:00 2001 From: David Molineus Date: Thu, 8 Feb 2018 21:57:20 +0100 Subject: [PATCH] Update readme and changelog. --- CHANGELOG.md | 1 + README.md | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c32c16b..01bd03f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ Version 1.3.0 (2018-02-xx) [Full Changelog](https://github.com/netzmacht/contao-leaflet-geocode-widget/compare/1.2.1...1.3.0) + - Move apply button to the modal footer. - Deprecate `Netzmacht\Contao\Leaflet\GeocodeWidget`. Use `Netzmacht\Contao\Leaflet\Widget\GeocodeWidget` instead. - Add feature to adjust a radius. - Allow Contao 4.5.0. diff --git a/README.md b/README.md index c5e055c..84b8d17 100644 --- a/README.md +++ b/README.md @@ -51,6 +51,8 @@ bin/console assets:install --symlink ### 4. Use the widget +#### Coordinates only + ```php $GLOBALS['TL_DCA']['tl_example']['fields']['coordinates'] = [ 'label' => ['Koordinaten', 'Geben Sie die Koordinaten ein'], @@ -61,3 +63,34 @@ $GLOBALS['TL_DCA']['tl_example']['fields']['coordinates'] = [ '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. + +```php +$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' => 'text', + 'eval' => [ + 'rgxp' => 'natural', + 'default' => 500, + 'minval' => 100, + 'maxval' => 5000, + 'tl_class' => 'w50', + ], + 'sql' => 'varchar(255) NOT NULL default \'\'' +]; +```