Allow Pick*Type to submit the form when selection an entity, and apply inside Event

This commit is contained in:
2023-11-28 12:35:19 +01:00
parent e902b6d409
commit 9b9c2774ad
10 changed files with 48 additions and 26 deletions

View File

@@ -43,6 +43,7 @@ class PickUserDynamicType extends AbstractType
$view->vars['uniqid'] = uniqid('pick_user_dyn');
$view->vars['suggested'] = [];
$view->vars['as_id'] = true === $options['as_id'] ? '1' : '0';
$view->vars['submit_on_adding_new_entity'] = true === $options['submit_on_adding_new_entity'] ? '1' : '0';
foreach ($options['suggested'] as $user) {
$view->vars['suggested'][] = $this->normalizer->normalize($user, 'json', ['groups' => 'read']);
@@ -58,7 +59,9 @@ class PickUserDynamicType extends AbstractType
->setDefault('suggested', [])
// if set to true, only the id will be set inside the content. The denormalization will not work.
->setDefault('as_id', false)
->setAllowedTypes('as_id', ['bool']);
->setAllowedTypes('as_id', ['bool'])
->setDefault('submit_on_adding_new_entity', false)
->setAllowedTypes('submit_on_adding_new_entity', ['bool']);
}
public function getBlockPrefix()