10namespace Depage\HtmlForm\Elements;
52 public static function getCountries(array|
string $iso =
null): array
56 'ae' => _(
"United Arab Emirates"),
57 'af' => _(
"Afghanistan"),
58 'ag' => _(
"Antigua & Barbuda"),
59 'ai' => _(
"Anguilla"),
62 'an' => _(
"Netherlands Antilles"),
64 'aq' => _(
"Antarctica"),
65 'ar' => _(
"Argentina"),
66 'as' => _(
"American Samoa"),
68 'au' => _(
"Australia"),
70 'az' => _(
"Azerbaijan"),
71 'ba' => _(
"Bosnia and Herzegovina"),
72 'bb' => _(
"Barbados"),
73 'bd' => _(
"Bangladesh"),
75 'bf' => _(
"Burkina Faso"),
76 'bg' => _(
"Bulgaria"),
81 'bn' => _(
"Brunei Darussalam"),
86 'bv' => _(
"Bouvet Island"),
87 'bw' => _(
"Botswana"),
91 'cc' => _(
"Cocos (Keeling) Islands"),
92 'cf' => _(
"Central African Republic"),
94 'ch' => _(
"Switzerland"),
95 'ci' => _(
"Côte D\'ivoire (Ivory Coast)"),
96 'ck' => _(
"Cook Iislands"),
98 'cm' => _(
"Cameroon"),
100 'co' => _(
"Colombia"),
101 'cr' => _(
"Costa Rica"),
103 'cv' => _(
"Cape Verde"),
104 'cx' => _(
"Christmas Island"),
106 'cz' => _(
"Czech Republic"),
107 'de' => _(
"Germany"),
108 'dj' => _(
"Djibouti"),
109 'dk' => _(
"Denmark"),
110 'dm' => _(
"Dominica"),
111 'do' => _(
"Dominican Republic"),
112 'dz' => _(
"Algeria"),
113 'ec' => _(
"Ecuador"),
114 'ee' => _(
"Estonia"),
116 'eh' => _(
"Western Sahara"),
117 'er' => _(
"Eritrea"),
119 'et' => _(
"Ethiopia"),
120 'fi' => _(
"Finland"),
122 'fk' => _(
"Falkland Islands"),
123 'fm' => _(
"Micronesia"),
124 'fo' => _(
"Faroe Islands"),
126 'fx' => _(
"France, Metropolitan"),
128 'gb' => _(
"United Kingdom"),
129 'gd' => _(
"Grenada"),
130 'ge' => _(
"Georgia"),
131 'gf' => _(
"French Guiana"),
133 'gi' => _(
"Gibraltar"),
134 'gl' => _(
"Greenland"),
137 'gp' => _(
"Guadeloupe"),
138 'gq' => _(
"Equatorial Guinea"),
140 'gs' => _(
"South Georgia and the South Sandwich Islands"),
141 'gt' => _(
"Guatemala"),
143 'gw' => _(
"Guinea-Bissau"),
145 'hk' => _(
"Hong Kong"),
146 'hm' => _(
"Heard & McDonald Islands"),
147 'hn' => _(
"Honduras"),
148 'hr' => _(
"Croatia"),
150 'hu' => _(
"Hungary"),
151 'id' => _(
"Indonesia"),
152 'ie' => _(
"Ireland"),
155 'io' => _(
"British Indian Ocean Territory"),
157 'ir' => _(
"Islamic Republic of Iran"),
158 'is' => _(
"Iceland"),
160 'jm' => _(
"Jamaica"),
164 'kg' => _(
"Kyrgyzstan"),
165 'kh' => _(
"Cambodia"),
166 'ki' => _(
"Kiribati"),
167 'km' => _(
"Comoros"),
168 'kn' => _(
"St. Kitts and Nevis"),
169 'kp' => _(
"Korea, Democratic People\'s Republic of"),
170 'kr' => _(
"Korea, Republic of"),
172 'ky' => _(
"Cayman Islands"),
173 'kz' => _(
"Kazakhstan"),
174 'la' => _(
"Lao People\'s Democratic Republic"),
175 'lb' => _(
"Lebanon"),
176 'lc' => _(
"Saint Lucia"),
177 'li' => _(
"Liechtenstein"),
178 'lk' => _(
"Sri Lanka"),
179 'lr' => _(
"Liberia"),
180 'ls' => _(
"Lesotho"),
181 'lt' => _(
"Lithuania"),
182 'lu' => _(
"Luxembourg"),
184 'ly' => _(
"Libyan Arab Jamahiriya"),
185 'ma' => _(
"Morocco"),
187 'md' => _(
"Moldova, Republic of"),
188 'mg' => _(
"Madagascar"),
189 'mh' => _(
"Marshall Islands"),
191 'mn' => _(
"Mongolia"),
192 'mm' => _(
"Myanmar"),
194 'mp' => _(
"Northern Mariana Islands"),
195 'mq' => _(
"Martinique"),
196 'mr' => _(
"Mauritania"),
197 'ms' => _(
"Monserrat"),
199 'mu' => _(
"Mauritius"),
200 'mv' => _(
"Maldives"),
203 'my' => _(
"Malaysia"),
204 'mz' => _(
"Mozambique"),
205 'na' => _(
"Namibia"),
206 'nc' => _(
"New Caledonia"),
208 'nf' => _(
"Norfolk Island"),
209 'ng' => _(
"Nigeria"),
210 'ni' => _(
"Nicaragua"),
211 'nl' => _(
"Netherlands"),
216 'nz' => _(
"New Zealand"),
220 'pf' => _(
"French Polynesia"),
221 'pg' => _(
"Papua New Guinea"),
222 'ph' => _(
"Philippines"),
223 'pk' => _(
"Pakistan"),
225 'pm' => _(
"St. Pierre & Miquelon"),
226 'pn' => _(
"Pitcairn"),
227 'pr' => _(
"Puerto Rico"),
228 'pt' => _(
"Portugal"),
230 'py' => _(
"Paraguay"),
232 're' => _(
"Réunion"),
233 'ro' => _(
"Romania"),
234 'ru' => _(
"Russian Federation"),
236 'sa' => _(
"Saudi Arabia"),
237 'sb' => _(
"Solomon Islands"),
238 'sc' => _(
"Seychelles"),
241 'sg' => _(
"Singapore"),
242 'sh' => _(
"St. Helena"),
243 'si' => _(
"Slovenia"),
244 'sj' => _(
"Svalbard & Jan Mayen Islands"),
245 'sk' => _(
"Slovakia"),
246 'sl' => _(
"Sierra Leone"),
247 'sm' => _(
"San Marino"),
248 'sn' => _(
"Senegal"),
249 'so' => _(
"Somalia"),
250 'sr' => _(
"Suriname"),
251 'st' => _(
"Sao Tome & Principe"),
252 'sv' => _(
"El Salvador"),
253 'sy' => _(
"Syrian Arab Republic"),
254 'sz' => _(
"Swaziland"),
255 'tc' => _(
"Turks & Caicos Islands"),
257 'tf' => _(
"French Southern Territories"),
259 'th' => _(
"Thailand"),
260 'tj' => _(
"Tajikistan"),
261 'tk' => _(
"Tokelau"),
262 'tm' => _(
"Turkmenistan"),
263 'tn' => _(
"Tunisia"),
265 'tp' => _(
"East Timor"),
267 'tt' => _(
"Trinidad & Tobago"),
269 'tw' => _(
"Taiwan, Province of China"),
270 'tz' => _(
"Tanzania, United Republic of"),
271 'ua' => _(
"Ukraine"),
273 'um' => _(
"United States Minor Outlying Islands"),
274 'us' => _(
"United States of America"),
275 'uy' => _(
"Uruguay"),
276 'uz' => _(
"Uzbekistan"),
277 'va' => _(
"Vatican City State (Holy See)"),
278 'vc' => _(
"St. Vincent & the Grenadines"),
279 've' => _(
"Venezuela"),
280 'vg' => _(
"British Virgin Islands"),
281 'vi' => _(
"United States Virgin Islands"),
282 'vn' => _(
"Viet Nam"),
283 'vu' => _(
"Vanuatu"),
284 'wf' => _(
"Wallis & Futuna Islands"),
287 'yt' => _(
"Mayotte"),
288 'yu' => _(
"Yugoslavia"),
289 'za' => _(
"South Africa"),
292 'zw' => _(
"Zimbabwe"),
297 if (is_array($iso)) {
298 return array_intersect_key($countries, array_fill_keys($iso,
true));
300 return isset($countries[$iso]) ? $countries[$iso] :
'';
317 parent::__construct(
$name, $parameters, $form);
319 if (isset($parameters[
'defaultValue'])) {
320 $this->defaults[
'defaultValue'] = $parameters[
'defaultValue'];
323 if (isset($parameters[
'priorityCountries'])) {
324 $this->defaults[
'priorityCountries'] = $parameters[
'priorityCountries'];
327 $this->list = isset($parameters[
'countries'])
328 ? $parameters[
'countries']
332 $this->list = array_change_key_case($this->list, CASE_LOWER);
338 if (defined(
"DEPAGE_LANG") && isset($parameters[
'priorityCountries'][DEPAGE_LANG])) {
339 $priorityCountries = array_reverse($parameters[
'priorityCountries'][DEPAGE_LANG],
true);
341 $priorityCountries = array_change_key_case($priorityCountries, CASE_LOWER);
343 foreach ($priorityCountries as &$country_code) {
344 if (isset($this->list[$country_code])) {
345 $top = [$country_code => $this->list[$country_code]];
346 unset($this->list[$country_code]);
352 $this->list = [
'' => _(
"Please Select")] +
$this->list;
366 parent::setDefaults();
368 $this->defaults[
'skin'] =
'select';
HTML-multiple-choice country input select .
$list
Contains list of ISO countries.
__construct(string $name, array $parameters, object $form)
multiple class constructor
static getCountries(array|string $iso=null)
Gets the Default Countries list.
setDefaults()
collects initial values across subclasses.
HTML-single-choice input type i.e.