<?php
declare(strict_types=1);
namespace BitBag\OpenMarketplace\Component\RFQ\Form\Type;
use Sylius\Bundle\ResourceBundle\Form\Type\AbstractResourceType;
use Symfony\Component\Form\Extension\Core\Type\CollectionType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Validator\Constraints\Count;
final class MessageType extends AbstractResourceType
{
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add('message', TextareaType::class, [
'label' => 'app.ui.message_to_vendor',
'required' => false,
])
->add('attachments', CollectionType::class, [
'entry_type' => AttachmentType::class,
'required' => false,
'prototype' => true,
'allow_add' => true,
'allow_delete' => true,
'by_reference' => false,
'label' => false,
'constraints' => [
new Count([
'max' => 2,
]),
],
])
;
}
public function getBlockPrefix(): string
{
return 'app_rfq_message';
}
}