- public function buildForm(FormBuilderInterface $builder, array $options) {
- return $builder
- ->setAttribute('label_prefix', $options['label_prefix'])
- ->add('title', TextType::class, ['attr' => ['placeholder' => 'Your title']])
- ->add('short', TextType::class, ['attr' => ['placeholder' => 'Your short']])
- ->add('address', TextType::class, ['attr' => ['placeholder' => 'Your address']])
- ->add('zipcode', NumberType::class, ['attr' => ['placeholder' => 'Your zipcode'], 'html5' => true])
- ->add('city', TextType::class, ['attr' => ['placeholder' => 'Your city']])
- ->add('latitude', NumberType::class, ['attr' => ['placeholder' => 'Your latitude', 'step' => 0.000001], 'html5' => true, 'scale' => 6])
- ->add('longitude', NumberType::class, ['attr' => ['placeholder' => 'Your longitude', 'step' => 0.000001], 'html5' => true, 'scale' => 6])
+ public function buildForm(FormBuilderInterface $builder, array $options): void {
+ //Build form
+ $builder
+ ->add('title', TextType::class, ['attr' => ['placeholder' => 'Your title'], 'constraints' => [new NotBlank(['message' => 'Please provide your title'])]])
+ ->add('description', TextareaType::class, ['attr' => ['placeholder' => 'Your description', 'cols' => 50, 'rows' => 15], 'required' => false])
+ ->add('address', TextType::class, ['attr' => ['placeholder' => 'Your address'], 'constraints' => [new NotBlank(['message' => 'Please provide your address'])]])
+ ->add('zipcode', NumberType::class, ['attr' => ['placeholder' => 'Your zipcode'], 'html5' => true, 'constraints' => [new NotBlank(['message' => 'Please provide your zipcode'])]])
+ ->add('city', TextType::class, ['attr' => ['placeholder' => 'Your city'], 'constraints' => [new NotBlank(['message' => 'Please provide your city'])]])
+ ->add('latitude', NumberType::class, ['attr' => ['placeholder' => 'Your latitude', 'step' => 0.000001], 'html5' => true, 'scale' => 6, 'constraints' => [new NotBlank(['message' => 'Please provide your latitude'])]])
+ ->add('longitude', NumberType::class, ['attr' => ['placeholder' => 'Your longitude', 'step' => 0.000001], 'html5' => true, 'scale' => 6, 'constraints' => [new NotBlank(['message' => 'Please provide your longitude'])]])
+ ->add('indoor', CheckboxType::class, ['attr' => ['placeholder' => 'Your indoor'], 'required' => false])