Download the PHP package voyage/silverstripe-nzpost-addressfinder without Composer
On this page you can find all versions of the php package voyage/silverstripe-nzpost-addressfinder. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download voyage/silverstripe-nzpost-addressfinder
More information about voyage/silverstripe-nzpost-addressfinder
Files in voyage/silverstripe-nzpost-addressfinder
Package silverstripe-nzpost-addressfinder
Short Description Add address autocomplete field using NZPost API
License
Informations about the package silverstripe-nzpost-addressfinder
NZ Post Address Finder
Address finder module for NZ Post API.
This is currently using the 1.0-client version of the API. All requests require your client_id and client_secret and does not use the Oauth implementation as in 1.0.
Getting started
Sign up with NZ Post for API access.
Grab your client_id and client_secret and add to your config.yml
file
This module comes with both the AddressFinderField
for use in your own Forms as well as the EditableAddressFinderField
for use in Userforms.
Form Field
Add the AddressFinderField in your Form like below. Make sure you add setFieldMap
and include the fields you want to map the returned results to.
The key should always be your form field ID and the value will be the NZ Post field (these values can be found below or in the NZ Post API documentation).
Userforms Field
This module comes with a field for use in Userforms. The EditableAddressFinderField
adds a mapping tab to the edit view of the field. Where you can add multiple mappings.
Each mapping requires the user forms field ID or name as well as a corresponding NZ Post value to grab.
Content Editors
When using the Userforms Field, content editors need to manually select the fields they want mapped via the CMS.
On the Field editing view, there is a tab for Mappings. From here a content editor can add a new field mapping and match another Userform Field ID/Name to an NZ Post Field ID.
The name for a userform field can be found in the Fields main tab.
Field Mappings
The following fields are available from NZ Post for mapping. The values shown are just examples based on the returned response.
Contributing
- Fork it!
- Create your feature branch:
git checkout -b my-new-feature
- Commit your changes:
git commit -am 'Add some feature'
- Push to the branch:
git push origin my-new-feature
- Submit a pull request :D
Acknowledgements
Silverstripe Google Address Field - Inspiration for mapping field values
License
TODO
- [ ] Add unit tests
- [ ] Add JS testing
- [ ] Make SS4 compatible
- [ ] Finish setting up Oauth
All versions of silverstripe-nzpost-addressfinder with dependencies
composer/installers Version *
silverstripe/framework Version >=3.5.0
guzzlehttp/guzzle Version ^6.3