SilverCommerce\GeoZones\Forms\RegionSelectionField
Custom field that makes use of Ajax to change the list of possible regions you can select.
This field needs to be linked with another field on the same form that will provide the
selected country code. EG:
$field = RegionSelectField::create("FieldName", "FieldTitle", "CountryFieldName");
Synopsis
class RegionSelectionField
extends DropdownField
{
- // members
- private static array $allowed_actions = ;
- private static array $url_handlers = ;
- private $country_field;
- protected boolean $create_empty_default = true;
- // methods
- public void getCountryField()
- public RegionSelectionField setCountryField()
- public array|ArrayAccess getSource()
- public void __construct()
- public void Field()
- public SSList getList()
- public string regionslist()
- public void getCreateEmptyDefault()
- public RegionSelectionField setCreateEmptyDefault()
Hierarchy
Extends
- SilverStripe\Forms\DropdownField
Members
private
- $allowed_actions
- $country_field
—
string
The name of the associated country field - $url_handlers
protected
- $create_empty_default
Methods
public
- __construct() — Custom constructor to allow us to define the associated country field
- Field() — Render the final field
- getCountryField() — Get the associated country field
- getCreateEmptyDefault() — Get the value of create_empty_default
- getList() — Get a list of regions, filtered by the provided country code
- getSource() — Overwrite default get source to return custom list of regions
- regionslist() — Return a list of regions based on the supplied country ID
- setCountryField() — Set the associated country field
- setCreateEmptyDefault() — Set the value of create_empty_default