mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-08-31 14:57:50 +02:00
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@60258 467b73ca-7a2a-4603-9d3b-597d59a354a9
32 lines
751 B
PHP
Executable File
32 lines
751 B
PHP
Executable File
<?php
|
|
|
|
/**
|
|
* @package sapphire
|
|
* @subpackage model
|
|
*/
|
|
|
|
/**
|
|
* Represents an multi-select enumeration field.
|
|
* @package sapphire
|
|
* @subpackage model
|
|
*/
|
|
class MultiEnum extends Enum {
|
|
function requireField(){
|
|
DB::requireField($this->tableName, $this->name, "set('" . implode("','", $this->enum) . "') character set utf8 collate utf8_general_ci default '{$this->default}'");
|
|
}
|
|
|
|
|
|
/**
|
|
* Return a dropdown field suitable for editing this field
|
|
*/
|
|
function formField($title = null, $name = null, $hasEmpty = false, $value = "", $form = null) {
|
|
if(!$title) $title = $this->name;
|
|
if(!$name) $name = $this->name;
|
|
|
|
$field = new CheckboxSetField($name, $title, $this->enumValues($hasEmpty), $value, $form);
|
|
|
|
return $field;
|
|
}
|
|
}
|
|
|
|
?>
|