Merge pull request #6137 from lekoala/patch-4

Have a clear error message
This commit is contained in:
Daniel Hensby 2016-10-04 14:13:00 +01:00 committed by GitHub
commit 111ab5f0af

View File

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