ENHANCEMENT: added EditableCountryDropdownField to allow country selection

This commit is contained in:
Will Rossiter 2010-12-01 21:59:56 +00:00
parent 591ad48eb9
commit 1feab6d401

View File

@ -0,0 +1,28 @@
<?php
/**
* A dropdown field which allows the user to select a country
*
* @package userforms
*/
class EditableCountryDropdownField extends EditableFormField {
static $singular_name = 'Country Dropdown';
static $plural_name = 'Country Dropdowns';
public function getFormField() {
return new DropdownField($this->Name, $this->Title, Geoip::getCountryDropDown());
}
public function getValueFromData($data) {
if(isset($data[$this->Name])) {
return Geoip::countryCode2name($data[$this->Name]);
}
}
public function getIcon() {
return 'userforms/images/editabledropdown.png';
}
}