silverstripe-userforms/code/model/formfields/EditableDropdown.php

31 lines
572 B
PHP
Raw Normal View History

<?php
/**
* EditableDropdown
*
* Represents a modifiable dropdown (select) box on a form
*
* @package userforms
*/
class EditableDropdown extends EditableMultipleOptionField {
static $singular_name = 'Dropdown Field';
static $plural_name = 'Dropdowns';
/**
* @return DropdownField
*/
function getFormField() {
$optionSet = $this->Options();
$options = array();
if($optionSet) {
foreach($optionSet as $option) {
$options[$option->Title] = $option->Title;
}
}
return new DropdownField($this->Name, $this->Title, $options);
}
}