From 03955b35edac32b5160ae181ced27ecf47c29273 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rapha=C3=ABl=20Gertz?= Date: Wed, 7 Jul 2021 17:22:38 +0200 Subject: [PATCH] Add calendar form --- Form/CalendarType.php | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 Form/CalendarType.php diff --git a/Form/CalendarType.php b/Form/CalendarType.php new file mode 100644 index 0000000..be5fcab --- /dev/null +++ b/Form/CalendarType.php @@ -0,0 +1,41 @@ +add('calendar', TextType::class, ['label' => 'Calendar id', 'attr' => ['placeholder' => 'Your calendar id'], 'constraints' => [new NotBlank(['message' => 'Please provide your calendar id'])]]) + //TODO: validate prefix against [a-v0-9]{5,} + //XXX: see https://developers.google.com/calendar/api/v3/reference/events/insert#id + ->add('prefix', TextType::class, ['label' => 'Prefix', 'attr' => ['placeholder' => 'Your prefix'], 'constraints' => [new NotBlank(['message' => 'Please provide your prefix'])]]) + ->add('project', TextType::class, ['label' => 'Project id', 'attr' => ['placeholder' => 'Your project id'], 'required' => false]) + ->add('client', TextType::class, ['label' => 'Client id', 'attr' => ['placeholder' => 'Your client id'], 'required' => false]) + ->add('secret', TextType::class, ['label' => 'Client secret', 'attr' => ['placeholder' => 'Your client secret'], 'required' => false]) + ->add('submit', SubmitType::class, ['label' => 'Send', 'attr' => ['class' => 'submit']]); + } + + /** + * {@inheritdoc} + */ + public function configureOptions(OptionsResolver $resolver) { + $resolver->setDefaults(['error_bubbling' => true]); + } + + /** + * {@inheritdoc} + */ + public function getName() { + return 'calendar_form'; + } +} -- 2.41.0