From d34def6b47f806e5509ba6423e987248b3630312 Mon Sep 17 00:00:00 2001 From: Sam Minnee Date: Fri, 5 Jun 2009 01:55:42 +0000 Subject: [PATCH] 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 --- forms/TreeMultiselectField.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/forms/TreeMultiselectField.php b/forms/TreeMultiselectField.php index 0fa7bb735..b4c933e81 100755 --- a/forms/TreeMultiselectField.php +++ b/forms/TreeMultiselectField.php @@ -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(); } -} \ No newline at end of file +} \ No newline at end of file