mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Detection of <FormField>_Readonly classes (fixes #1473)
Consistent behavior with _Disabled classes
This commit is contained in:
parent
ef3d974821
commit
35b6887568
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user