Detection of <FormField>_Readonly classes (fixes #1473)

Consistent behavior with _Disabled classes
This commit is contained in:
Ingo Schommer 2013-04-05 11:08:17 +02:00
parent ef3d974821
commit 35b6887568

View File

@ -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;
}
/**