<?php
namespace AdminBundle\Form\Type\Vehicle;
use Application\Sonata\MediaBundle\Entity\Media;
use FOS\CKEditorBundle\Form\Type\CKEditorType;
use Sonata\MediaBundle\Form\Type\MediaType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\TextareaType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\Extension\Core\Type\CollectionType;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Validator\Constraints\Length;
class InterestingType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder->add('title', TextType::class, [
'label' => 'Заголовок',
'attr' => [
'maxlength' => 65,
'class' => 'col-md-3'
],
'required' => false,
])
->add('link', TextType::class, [
'label' => 'Посилання "Детальніше"',
'attr' => [
'class' => 'col-md-3'
],
'required' => false,
])
// ->add('description', TextareaType::class, [
// 'label' => 'Текст ',
// 'attr' => [
// 'maxlength' => 1150,
// 'class' => 'col-md-3',
// 'style' => 'margin-bottom: 50px;'
// ],
// 'required' => false,
// ]);
->add('description', CKEditorType::class, [
'config_name' => 'default',
'label' => 'Контент',
'config' => [],
'attr' => [
'maxlength' => 1150,
],
'constraints' => [
new Length([
'max' => 1150,
'maxMessage' => 'Контент не може перевищувати {{ limit }} символів.',
]),
],
]);
}
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'compound' => true,
]);
}
}