BUGFIX: Fixed readonly version of TreeMultiselectField

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.3@78471 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sam Minnee 2009-06-05 01:55:42 +00:00
parent 74c89fced4
commit d34def6b47

View File

@ -85,16 +85,22 @@ HTML;
* Changes this field to the readonly field.
*/
function performReadonlyTransformation() {
return new TreeMultiselectField_Readonly($this->name, $this->title, $this->sourceObject, $this->keyField, $this->labelField);
}
}
class TreeMultiselectField_Readonly extends TreeMultiselectField {
function Field() {
$titleArray = array();
$titleList = array();
if($items = $this->getItems()) {
foreach($items as $item) $titleArray[] = $item->Title;
if($titleArray) $titleList = implode(", ", $titleArray);
}
$field = new ReadonlyField($this->name, $this->title);
$field->setValue($titleList);
$field->setForm($this->form);
return $field;
return $field->Field();
}
}
}