mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-14 06:14:23 +00:00
fix form for new custom group
If the CustomFieldGroup->getEntity is not set, the form for creation throw an error
This commit is contained in:
parent
0c2b5f3fb4
commit
0cecb67645
@ -49,11 +49,16 @@ class CustomFieldsGroupType extends AbstractType
|
|||||||
))
|
))
|
||||||
;
|
;
|
||||||
|
|
||||||
$builder->addEventListener(FormEvents::POST_SET_DATA, function(FormEvent $event)
|
$builder->addEventListener(FormEvents::POST_SET_DATA,
|
||||||
use ($customizableEntities, $builder){
|
function(FormEvent $event) use ($customizableEntities, $builder){
|
||||||
$form = $event->getForm();
|
$form = $event->getForm();
|
||||||
$group = $event->getData();
|
$group = $event->getData();
|
||||||
|
|
||||||
|
//stop the function if entity is not set
|
||||||
|
if ($group->getEntity() === NULL) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (count($customizableEntities[$group->getEntity()]['options']) > 0) {
|
if (count($customizableEntities[$group->getEntity()]['options']) > 0) {
|
||||||
$optionBuilder = $builder
|
$optionBuilder = $builder
|
||||||
->getFormFactory()
|
->getFormFactory()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user