2008-09-29 03:18:23 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* EditableDropdown
|
2009-04-17 02:26:40 +00:00
|
|
|
*
|
2010-09-03 05:06:13 +00:00
|
|
|
* Represents a modifiable dropdown (select) box on a form
|
2009-04-17 02:26:40 +00:00
|
|
|
*
|
|
|
|
* @package userforms
|
2008-09-29 03:18:23 +00:00
|
|
|
*/
|
2009-12-07 02:04:20 +00:00
|
|
|
|
2009-04-17 02:26:40 +00:00
|
|
|
class EditableDropdown extends EditableMultipleOptionField {
|
2008-09-29 03:18:23 +00:00
|
|
|
|
2013-04-02 18:34:43 -07:00
|
|
|
private static $singular_name = 'Dropdown Field';
|
2008-09-29 03:18:23 +00:00
|
|
|
|
2013-04-02 18:34:43 -07:00
|
|
|
private static $plural_name = 'Dropdowns';
|
2008-09-29 03:18:23 +00:00
|
|
|
|
2010-09-03 05:06:13 +00:00
|
|
|
/**
|
|
|
|
* @return DropdownField
|
|
|
|
*/
|
2012-05-04 13:39:08 +12:00
|
|
|
public function getFormField() {
|
2008-09-29 03:18:23 +00:00
|
|
|
$optionSet = $this->Options();
|
|
|
|
$options = array();
|
2010-09-03 05:06:13 +00:00
|
|
|
|
2009-04-27 06:00:05 +00:00
|
|
|
if($optionSet) {
|
2010-09-03 05:06:13 +00:00
|
|
|
foreach($optionSet as $option) {
|
2009-04-27 06:00:05 +00:00
|
|
|
$options[$option->Title] = $option->Title;
|
|
|
|
}
|
2009-04-17 02:26:40 +00:00
|
|
|
}
|
2010-09-03 05:06:13 +00:00
|
|
|
|
|
|
|
return new DropdownField($this->Name, $this->Title, $options);
|
2008-09-29 03:18:23 +00:00
|
|
|
}
|
2009-12-07 02:04:20 +00:00
|
|
|
}
|