diff --git a/Form/CustomFieldsGroupType.php b/Form/CustomFieldsGroupType.php index 204c4e3f8..4ab4379ff 100644 --- a/Form/CustomFieldsGroupType.php +++ b/Form/CustomFieldsGroupType.php @@ -49,11 +49,16 @@ class CustomFieldsGroupType extends AbstractType )) ; - $builder->addEventListener(FormEvents::POST_SET_DATA, function(FormEvent $event) - use ($customizableEntities, $builder){ + $builder->addEventListener(FormEvents::POST_SET_DATA, + function(FormEvent $event) use ($customizableEntities, $builder){ $form = $event->getForm(); $group = $event->getData(); + //stop the function if entity is not set + if ($group->getEntity() === NULL) { + return; + } + if (count($customizableEntities[$group->getEntity()]['options']) > 0) { $optionBuilder = $builder ->getFormFactory()