2017 © Pedro Peláez
 

silverstripe-vendormodule silverstripe-addressfield

Silverstripe address field with geolocation

image

thewebmen/silverstripe-addressfield

Silverstripe address field with geolocation

  • Tuesday, July 31, 2018
  • by michelsteege
  • Repository
  • 3 Watchers
  • 0 Stars
  • 207 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 11 Versions
  • 101 % Grown

The README.md

SilverStripe Address field

Introduction

Address field with geolocation, (*1)

Requirements

  • SilverStripe CMS ^4.0
  • "jeroendesloovere/geolocation-php-api": "1.3.*"

Installation

composer require "thewebmen/silverstripe-addressfield" "dev-master"

Config

Add the Google Maps API key:, (*2)

TheWebmen\Addressfield\Forms\GooglePlacesField:
  maps_api_key: 'API_KEY'

Or add the following variable to your .env:, (*3)

WDVLP_ADDRESSFIELD_MAPS_API_KEY='API_KEY'

Usage

Add all db fields to the db array:, (*4)

private static $db = [
        'City' => 'Varchar',
        'Country' => 'Varchar',
        'ZipCode' => 'Varchar',
        'Street' => 'Varchar',
        'StreetNumber' => 'Varchar',
        'Latitude' => 'Varchar',
        'Longitude' => 'Varchar'
    ];

Then add the field like any other field, (*5)

public function updateCMSFields(FieldList $fields)
    {
        $fields->addFieldToTab('Root.Address', new AddressField($this->owner));
    }

See the addressfield class for all constructor options., (*6)

Distance helper

The module comes with a distance helper to calculate the distance between two latitude/longitudes, example usage:, (*7)

    $list = ObjectWithLatitudeLongitude::get();
    $list = TheWebmen\Addressfield\Helpers\DistanceHelper::addDistance($list, '52.2112', '5.9699');
    $list = $list->sort('Distance');
    foreach($list as $item){
        var_dump($item->Distance);
    }

Todo

  • Improve documentation

The Versions

31/07 2018

dev-master

9999999-dev

Silverstripe address field with geolocation

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

by Michel van der Steege

form address geolocation silverstripe field

31/07 2018

1.0.8

1.0.8.0

Silverstripe address field with geolocation

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

by Michel van der Steege

form address geolocation silverstripe field

22/03 2018

1.0.7

1.0.7.0

Silverstripe address field with geolocation

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

by Michel van der Steege

form address geolocation silverstripe field

04/03 2018

1.0.6

1.0.6.0

Silverstripe address field with geolocation

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

by Michel van der Steege

form address geolocation silverstripe field

01/03 2018

1.0.5

1.0.5.0

Silverstripe address field with geolocation

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

by Michel van der Steege

form address geolocation silverstripe field

28/02 2018

1.0.4

1.0.4.0

Silverstripe address field with geolocation

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

by Michel van der Steege

form address geolocation silverstripe field

27/02 2018

1.0.3

1.0.3.0

Silverstripe address field with geolocation

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

by Michel van der Steege

form address geolocation silverstripe field

08/12 2017

1.0.2

1.0.2.0

Silverstripe address field with geolocation

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

by Michel van der Steege

form address geolocation silverstripe field

08/12 2017

1.0.1

1.0.1.0

Silverstripe address field with geolocation

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

by Michel van der Steege

form address geolocation silverstripe field

08/12 2017

1.0.0

1.0.0.0

Silverstripe address field with geolocation

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

by Michel van der Steege

form address geolocation silverstripe field

08/12 2017

0.0.1

0.0.1.0

Silverstripe address field with geolocation

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

by Michel van der Steege

form address geolocation silverstripe field