1 <?php
declare(strict_types
=1);
4 * This file is part of the Rapsys AirBundle package.
6 * (c) Raphaël Gertz <symfony@rapsys.eu>
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Rapsys\AirBundle\Form
;
14 use Symfony\Component\Form\AbstractType
;
15 use Symfony\Component\Form\FormBuilderInterface
;
16 use Symfony\Component\OptionsResolver\OptionsResolver
;
17 use Symfony\Component\Form\Extension\Core\Type\ChoiceType
;
18 use Symfony\Component\Form\Extension\Core\Type\SubmitType
;
20 class CalendarType
extends AbstractType
{
24 public function buildForm(FormBuilderInterface
$builder, array $options): void {
27 ->add('calendar', ChoiceType
::class, ['attr' => ['placeholder' => 'Your calendar'], 'choice_translation_domain' => false, 'expanded' => true, 'multiple' => true, 'choices' => $options['calendar_choices']/*, 'data' => $options['calendar_default']*/, 'choice_attr' => ['class' => 'row']])
28 ->add('submit', SubmitType
::class, ['label' => 'Send', 'attr' => ['class' => 'submit']])
29 ->add('refresh', SubmitType
::class, ['label' => 'Refresh', 'attr' => ['class' => 'submit']])
30 ->add('add', SubmitType
::class, ['label' => 'Add', 'attr' => ['class' => 'submit']])
31 ->add('delete', SubmitType
::class, ['label' => 'Delete', 'attr' => ['class' => 'submit']])
32 ->add('unlink', SubmitType
::class, ['label' => 'Unlink', 'attr' => ['class' => 'submit']]);
38 public function configureOptions(OptionsResolver
$resolver): void {
40 $resolver->setDefaults(['error_bubbling' => true, 'calendar_choices' => [], /*'calendar_default' => ['primary']*/]);
42 //Add calendar choices
43 $resolver->setAllowedTypes('calendar_choices', 'array');
45 //Add calendar default
46 #$resolver->setAllowedTypes('calendar_default', 'integer');
52 public function getName(): string {
53 return 'calendar_form';