diff --git a/src/EntityClone/Content/ContentEntityCloneFormBase.php b/src/EntityClone/Content/ContentEntityCloneFormBase.php index 3e402a8..40f62ad 100644 --- a/src/EntityClone/Content/ContentEntityCloneFormBase.php +++ b/src/EntityClone/Content/ContentEntityCloneFormBase.php @@ -153,7 +153,9 @@ protected function getRecursiveFormElement(FieldConfigInterface $field_definitio '#type' => 'hidden', '#value' => $referenced_entity->bundle(), ]; - $form_element[$field_definition->id()]['references'][$referenced_entity->id()]['children'] = $this->getChildren($referenced_entity); + if ($referenced_entity instanceOf ContentEntityInterface) { + $form_element[$field_definition->id()]['references'][$referenced_entity->id()]['children'] = $this->getChildren($referenced_entity); + } } return $form_element;