diff --git a/modules/backend/formwidgets/Relation.php b/modules/backend/formwidgets/Relation.php index e0e218b47..ed117bb77 100644 --- a/modules/backend/formwidgets/Relation.php +++ b/modules/backend/formwidgets/Relation.php @@ -108,9 +108,10 @@ class Relation extends FormWidgetBase $relatedObj = $model->makeRelation($attribute); $query = $model->{$attribute}()->newQuery(); - if (in_array($this->relationType, ['belongsToMany', 'morphToMany', 'morphedByMany'])) { + if (in_array($this->relationType, ['belongsToMany', 'morphToMany', 'morphedByMany', 'hasMany'])) { $field->type = 'checkboxlist'; - } elseif ($this->relationType == 'belongsTo') { + } + elseif (in_array($this->relationType, ['belongsTo', 'hasOne'])) { $field->type = 'dropdown'; $field->placeholder = $this->emptyOption; }