Download the PHP package silverware/countries without Composer
On this page you can find all versions of the php package silverware/countries. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download silverware/countries
More information about silverware/countries
Files in silverware/countries
Package countries
Short Description SilverWare Countries Module.
License BSD-3-Clause
Homepage https://github.com/praxisnetau/silverware-countries
Informations about the package countries
SilverWare Countries Module
Provides a CountryDropdownField
for use in SilverStripe v4 forms.
Contents
- Background
- Requirements
- Installation
- Configuration
- Usage
- Issues
- Contribution
- Maintainers
- License
Background
SilverStripe decided to remove CountryDropdownField
from framework
in v4, which can be
a pretty handy field when you need an international address entered into a form. This module
provides a replacement field, with similar configuration options to the original.
Requirements
Installation
Installation is via Composer:
Configuration
As with all SilverStripe modules, configuration is via YAML. There are three
configuration options available for CountryDropdownField
:
default_to_locale
- default setting is false; if set to true, the default value for the field will be based on either the locale of the current user, or the default locale for the app (obtained fromi18n
).default_country
- default setting is null; defines the country code to use as the default value ifdefault_to_locale
is set to false.invalid_countries
- defines a list of country codes which are considered invalid and are removed from the default source data.
Differences from Original Class
Note: default_to_locale
and default_country
in this module are different from the
original SilverStripe field. The original class had default_to_locale
set to true, and default_country
set to NZ
.
You can still set these defaults through configuration if you wish, however I figured it would be better to not make assumptions about locale or country by default. More often than not these defaults were overridden for projects using the original field.
Usage
To make use of the field within your code, simply use
the class within the header
of your file:
You can then create an instance of the field within your form code:
Issues
Please use the GitHub issue tracker for bug reports and feature requests.
Contribution
Your contributions are gladly welcomed to help make this project better. Please see contributing for more information.
Maintainers
Colin Tucker | Praxis Interactive |
License
BSD-3-Clause © Praxis Interactive