mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
Have a clear error message
Because it's really annoying not knowing which field causes the error
This commit is contained in:
parent
f2d3026e93
commit
3d8db488d4
@ -550,7 +550,12 @@ class FieldList extends ArrayList {
|
||||
public function makeFieldReadonly($field) {
|
||||
$fieldName = ($field instanceof FormField) ? $field->getName() : $field;
|
||||
$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…
x
Reference in New Issue
Block a user