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

31 lines
595 B
PHP
Raw Normal View History

<?php
/**
* EditableDropdown
*
* Represents a modifiable dropdown (select) box on a form
*
* @package userforms
*/
class EditableDropdown extends EditableMultipleOptionField {
private static $singular_name = 'Dropdown Field';
private static $plural_name = 'Dropdowns';
/**
* @return DropdownField
*/
public 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);
}
}