Version: current

     1 <?php
     2
     3 /**
     4  * A dropdown field which allows the user to select a country
     5  *
     6  * @package userforms
     7  */
     8 class EditableCountryDropdownField extends EditableFormField {
     9
    10     static $singular_name = 'Country Dropdown';
    11
    12     static $plural_name = 'Country Dropdowns';
    13
    14     public function getFormField() {
    15         return new CountryDropdownField($this->Name, $this->Title);
    16     }
    17
    18     public function getValueFromData($data) {
    19         if(isset($data[$this->Name])) {
    20
    21             return Geoip::countryCode2name($data[$this->Name]);
    22         }
    23     }
    24
    25     public function getIcon() {
    26         return 'userforms/images/editabledropdown.png';
    27     }
    28 }

[Raise a SilverStripe Framework issue/bug](https://github.com/silverstripe/silverstripe-framework/issues/new)
- [Raise a SilverStripe CMS issue/bug](https://github.com/silverstripe/silverstripe-cms/issues/new)
- Please use the Silverstripe Forums to ask development related questions. -