diff --git a/modules/backend/formwidgets/Relation.php b/modules/backend/formwidgets/Relation.php index 39fd11a93..21c3544cc 100644 --- a/modules/backend/formwidgets/Relation.php +++ b/modules/backend/formwidgets/Relation.php @@ -101,7 +101,11 @@ class Relation extends FormWidgetBase $foreignKey = $relationObj->getForeignKey(); $field->value = $this->model->$foreignKey; } - + else if ($this->relationType == ('morphToMany' || 'morphedByMany')) { + $field->type = 'checkboxlist'; + $field->value = $relationObj->getRelatedIds(); + } + // It is safe to assume that if the model and related model are of // the exact same class, then it cannot be related to itself if ($this->model->exists && (get_class($this->model) == get_class($relatedObj))) {