Giter VIP home page Giter VIP logo

silverstripe-addressable's Introduction

SilverStripe Addressable Module

Build Status

The Addressable module adds address fields to an object, and also has support for automatic geocoding.

Maintainer Contact

Requirements

  • SilverStripe 3.0+

Documentation

Quick Usage Overview

In order to add simple address fields (address, suburb, city, postcode and country) to an object, simply apply to Addressable extension:

Page:
  extensions:
    - Addressable

In order to then render the full address into a template, you can use either $FullAddress to return a simple string, or $FullAddressHTML to render the address into a HTML <address> tag.

You can define a global set of allowed states or countries using Addressable::set_allowed_states() and ::set_allowed_countries() respectively. These can also be set per-instance using setAllowedStates() and setAllowedCountries().

If a single string is provided as a value, then this will be set as the field for all new objects and the user will not be presented with an input field. If the value is an array, the user will be presented with a dropdown field.

To add automatic geocoding to an Addressable object when the address is changed, simple apply the Geocodable extension:

Page: 
  extensions: 
    - Geocodable

This will then use the Google Maps API to translate the address into a latitude and longitude on save, and save it into the Lat and Lng fields. NOTE - to support this, you must specify a Google app Server API key

GoogleGeocoding:
  google_api_key: {your_google_server_api_key}
  

Allow different postcode regex (e.g. UK postcode with numbers and letters mixed) in config.yml

Addressable:
  set_postcode_regex: '/^[0-9A-Za-z]+$/'

silverstripe-addressable's People

Contributors

nyeholt avatar ajshort avatar sheadawson avatar jedateach avatar alexoconner avatar muskie9 avatar nedmas avatar sonet avatar silbinarywolf avatar linkdup avatar yuchen-liu avatar

Watchers

James Cloos avatar Klemen avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.