From c29a0bb4c8c816f8a2da3e9618c9a97d5693228f Mon Sep 17 00:00:00 2001 From: Peter O Date: Fri, 30 May 2014 12:13:11 -0500 Subject: [PATCH] Add morphTomany and morphedByMany support --- modules/backend/formwidgets/Relation.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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))) {