src/Form/TicketPortalFormType.php line 27

Open in your IDE?
  1. <?php
  2. namespace App\Form;
  3. use App\Entity\Tickets;
  4. use App\Entity\Users;
  5. use App\Entity\Categories;
  6. use App\Entity\Status;
  7. use App\Entity\Priorities;
  8. use App\Entity\Accounts;
  9. use App\Entity\Departments;
  10. use Symfony\Component\Form\AbstractType;
  11. use Symfony\Component\Form\FormBuilderInterface;
  12. use Symfony\Component\OptionsResolver\OptionsResolver;
  13. use Symfony\Component\Form\Extension\Core\Type\TextType;
  14. use Symfony\Component\Form\Extension\Core\Type\IntegerType;
  15. use Symfony\Component\Form\Extension\Core\Type\TextareaType;
  16. use Symfony\Component\Form\Extension\Core\Type\FileType;
  17. use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
  18. use Symfony\Component\Form\Extension\Core\Type\DateType;
  19. use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
  20. use Symfony\Component\Validator\Constraints\IsTrue;
  21. use Symfony\Bridge\Doctrine\Form\Type\EntityType;
  22. use Symfony\Component\Form\Extension\Core\Type\NumberType;
  23. use Symfony\Contracts\Translation\TranslatorInterface;
  24. class TicketPortalFormType extends AbstractType
  25. {
  26.     public function buildForm(FormBuilderInterface $builder, array $options): void
  27.     {
  28.         $builder
  29.                     ->add('subject'TextType::class, [
  30.                         'attr' => [                  
  31.                             'class' => 'form-control',
  32.                             'placeholder' => 'Subject'
  33.                         ],
  34.                         'label' => false,
  35.                     ])
  36.                     ->add('description'TextareaType::class, [
  37.                         'attr' => [                  
  38.                             'class' => 'form-control',
  39.                             'placeholder' => 'Description'
  40.                         ],
  41.                         'label' => false,
  42.                     ])
  43.                     
  44.                     ->add('notes'TextareaType::class, [
  45.                         'attr' => [                  
  46.                             'class' => 'form-control',
  47.                             'placeholder' => 'Notes'
  48.                         ],
  49.                         'label' => false,
  50.                     ])
  51.                     ->add('agreeTerms'CheckboxType::class, [
  52.                         'mapped' => false,
  53.                         'label'    => 'Agree with terms ',
  54.                         'constraints' => [
  55.                             new IsTrue([
  56.                                 'message' => 'You should agree to our terms.',
  57.                             ]),
  58.                         ],
  59.                     ])
  60.             ;
  61.     }
  62.     public function configureOptions(OptionsResolver $resolver): void
  63.     {
  64.         $resolver->setDefaults([
  65.             'data_class' => Tickets::class,
  66.         ]);
  67.     }
  68. }