src/Forms/RegionSelectionField.php
public function getList($country)
    {
        $list = Region::get()
            ->filter("CountryCode", strtoupper($country));

        if (!$list->exists() && $this->getCreateEmptyDefault()) {
            $countries = i18n::getData()->getCountries();
            if (isset($countries[strtolower($country)])) {
                $name = $countries[strtolower($country)];
            } else {
                $name = $country;
            }
            $list = ArrayList::create();
            $list->push(Region::create([
                "Name" => $name,
                "Type" => "Nation",
                "Code" => strtoupper($country),
                "CountryCode" => strtoupper($country)
            ]));
        }

        return $list;
    }
public function getList($country)
    {
        $list = Region::get()
            ->filter("CountryCode", strtoupper($country));

        if (!$list->exists() && $this->getCreateEmptyDefault()) {
            $countries = i18n::getData()->getCountries();
            if (isset($countries[strtolower($country)])) {
                $name = $countries[strtolower($country)];
            } else {
                $name = $country;
            }
            $list = ArrayList::create();
            $list->push(Region::create([
                "Name" => $name,
                "Type" => "Nation",
                "Code" => strtoupper($country),
                "CountryCode" => strtoupper($country)
            ]));
        }

        return $list;
    }
public function getList ( $ country ) { $ list = Region :: get ( ) -> filter ( "CountryCode" , strtoupper ( $ country ) ) ; if ( ! $ list -> exists ( ) && $ this -> getCreateEmptyDefault ( ) ) { $ countries = i18n :: getData ( ) -> getCountries ( ) ; if ( isset ( $ countries [ strtolower ( $ country ) ] ) ) { $ name = $ countries [ strtolower ( $ country ) ] ; } else { $ name = $ country ; } $ list = ArrayList :: create ( ) ; $ list -> push ( Region :: create ( [ "Name" => $ name , "Type" => "Nation" , "Code" => strtoupper ( $ country ) , "CountryCode" => strtoupper ( $ country ) ] ) ) ; } return $ list ; }
Get a list of regions, filtered by the provided country code

@return SSList
Get a list of regions filtered by the provided country code