SilverWare Countries Module.
CountryDropdownField for use in SilverStripe v4 forms.
SilverStripe decided to remove
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.
Installation is via Composer:
$ composer require silverware/countries
As with all SilverStripe modules, configuration is via YAML. There are three
configuration options available for
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 from
default_country- default setting is null; defines the country code to use as the default value if
default_to_localeis set to false.
invalid_countries- defines a list of country codes which are considered invalid and are removed from the default source data.
default_country in this module are different from the
original SilverStripe field. The original class had
set to true, and
default_country set to
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.
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:
Please use the GitHub issue tracker for bug reports and feature requests.
Your contributions are gladly welcomed to help make this project better. Please see contributing for more information.
|Colin Tucker||Praxis Interactive|
BSD-3-Clause © Praxis Interactive