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