From 35b68875686f5047ca3aac305055a1825288bbfa Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Fri, 5 Apr 2013 11:08:17 +0200 Subject: [PATCH] Detection of _Readonly classes (fixes #1473) Consistent behavior with _Disabled classes --- forms/FormField.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/forms/FormField.php b/forms/FormField.php index d682315e2..757add144 100644 --- a/forms/FormField.php +++ b/forms/FormField.php @@ -709,9 +709,15 @@ class FormField extends RequestHandler { * Returns a readonly version of this field */ public function performReadonlyTransformation() { - $copy = $this->castedCopy('ReadonlyField'); - $copy->setReadonly(true); - return $copy; + $readonlyClassName = $this->class . '_Disabled'; + if(ClassInfo::exists($readonlyClassName)) { + $clone = $this->castedCopy($readonlyClassName); + } else { + $clone = $this->castedCopy('ReadonlyField'); + $clone->setReadonly(true); + } + + return $clone; } /**