From 0534a5ec0c79ff4ee3412eaf58d476614763179e Mon Sep 17 00:00:00 2001 From: Christopher Joe Date: Wed, 17 May 2017 16:51:30 +1200 Subject: [PATCH] Fix TreeDowndropField copying --- src/Forms/TreeDropdownField.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/Forms/TreeDropdownField.php b/src/Forms/TreeDropdownField.php index a46ddb40d..561848fa6 100644 --- a/src/Forms/TreeDropdownField.php +++ b/src/Forms/TreeDropdownField.php @@ -636,6 +636,21 @@ class TreeDropdownField extends FormField $copy->setSourceObject($this->sourceObject); return $copy; } + + /** + * @param string|FormField $classOrCopy + * @return FormField + */ + public function castedCopy($classOrCopy) + { + $field = $classOrCopy; + + if (!is_object($field)) { + $field = new $classOrCopy($this->name, $this->title, $this->sourceObject); + } + + return parent::castedCopy($field); + } public function getSchemaStateDefaults() {