mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Merge pull request #6137 from lekoala/patch-4
Have a clear error message
This commit is contained in:
commit
111ab5f0af
@ -550,7 +550,12 @@ class FieldList extends ArrayList {
|
|||||||
public function makeFieldReadonly($field) {
|
public function makeFieldReadonly($field) {
|
||||||
$fieldName = ($field instanceof FormField) ? $field->getName() : $field;
|
$fieldName = ($field instanceof FormField) ? $field->getName() : $field;
|
||||||
$srcField = $this->dataFieldByName($fieldName);
|
$srcField = $this->dataFieldByName($fieldName);
|
||||||
$this->replaceField($fieldName, $srcField->performReadonlyTransformation());
|
if($srcField) {
|
||||||
|
$this->replaceField($fieldName, $srcField->performReadonlyTransformation());
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
user_error("Trying to make field '$fieldName' readonly, but it does not exist in the list",E_USER_WARNING);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user