src/Component/RFQ/Form/Type/MessageType.php line 13

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace BitBag\OpenMarketplace\Component\RFQ\Form\Type;
  4. use Sylius\Bundle\ResourceBundle\Form\Type\AbstractResourceType;
  5. use Symfony\Component\Form\Extension\Core\Type\CollectionType;
  6. use Symfony\Component\Form\Extension\Core\Type\TextareaType;
  7. use Symfony\Component\Form\FormBuilderInterface;
  8. use Symfony\Component\Validator\Constraints\Count;
  9. final class MessageType extends AbstractResourceType
  10. {
  11.     public function buildForm(FormBuilderInterface $builder, array $options): void
  12.     {
  13.         $builder
  14.             ->add('message'TextareaType::class, [
  15.                 'label' => 'app.ui.message_to_vendor',
  16.                 'required' => false,
  17.             ])
  18.             ->add('attachments'CollectionType::class, [
  19.                 'entry_type' => AttachmentType::class,
  20.                 'required' => false,
  21.                 'prototype' => true,
  22.                 'allow_add' => true,
  23.                 'allow_delete' => true,
  24.                 'by_reference' => false,
  25.                 'label' => false,
  26.                 'constraints' => [
  27.                     new Count([
  28.                         'max' => 2,
  29.                     ]),
  30.                 ],
  31.             ])
  32.         ;
  33.     }
  34.     public function getBlockPrefix(): string
  35.     {
  36.         return 'app_rfq_message';
  37.     }
  38. }