validate that a classname had been set

This commit is contained in:
Bram de Leeuw 2019-07-15 11:15:30 +02:00
parent e80795b52d
commit 8703ace32a
1 changed files with 12 additions and 0 deletions

View File

@ -39,6 +39,18 @@ class Validator extends RequiredFields
return false;
}
// When the record is unsaved and the classname is not set throw an error
if ((!$this->record || !$this->record->exists()) && (!isset($data['ClassName']) || empty($data['ClassName']))) {
$this->validationError(
'ClassName',
_t(
__CLASS__ . 'CLASSNAME_ERROR',
'You need to select a field type before you can create the field'
)
);
return false;
}
// Skip unsaved records
if (!$this->record || !$this->record->exists()) {
return true;