src/AdminBundle/Form/Type/Vehicle/InterestingType.php line 16

Open in your IDE?
  1. <?php
  2. namespace AdminBundle\Form\Type\Vehicle;
  3. use Application\Sonata\MediaBundle\Entity\Media;
  4. use FOS\CKEditorBundle\Form\Type\CKEditorType;
  5. use Sonata\MediaBundle\Form\Type\MediaType;
  6. use Symfony\Component\Form\AbstractType;
  7. use Symfony\Component\Form\Extension\Core\Type\TextareaType;
  8. use Symfony\Component\Form\FormBuilderInterface;
  9. use Symfony\Component\Form\Extension\Core\Type\TextType;
  10. use Symfony\Component\Form\Extension\Core\Type\CollectionType;
  11. use Symfony\Component\OptionsResolver\OptionsResolver;
  12. use Symfony\Component\Validator\Constraints\Length;
  13. class InterestingType extends AbstractType
  14. {
  15.     public function buildForm(FormBuilderInterface $builder, array $options): void
  16.     {
  17.         $builder->add('title'TextType::class, [
  18.                 'label' => 'Заголовок',
  19.                 'attr' => [
  20.                     'maxlength' => 65,
  21.                     'class' => 'col-md-3'
  22.                 ],
  23.                 'required' => false,
  24.             ])
  25.             ->add('link'TextType::class, [
  26.                 'label' => 'Посилання "Детальніше"',
  27.                 'attr' => [
  28.                     'class' => 'col-md-3'
  29.                 ],
  30.                 'required' => false,
  31.             ])
  32. //            ->add('description', TextareaType::class, [
  33. //                'label' => 'Текст ',
  34. //                'attr' => [
  35. //                    'maxlength' => 1150,
  36. //                    'class' => 'col-md-3',
  37. //                    'style' => 'margin-bottom: 50px;'
  38. //                ],
  39. //                'required' => false,
  40. //            ]);
  41.                 ->add('description'CKEditorType::class, [
  42.                     'config_name' => 'default',
  43.                     'label' => 'Контент',
  44.                     'config' => [],
  45.                     'attr' => [
  46.                         'maxlength' => 1150,
  47.                     ],
  48.                     'constraints' => [
  49.                         new Length([
  50.                             'max' => 1150,
  51.                             'maxMessage' => 'Контент не може перевищувати {{ limit }} символів.',
  52.                         ]),
  53.                      ],
  54.                 ]);
  55.     }
  56.     public function configureOptions(OptionsResolver $resolver): void
  57.     {
  58.         $resolver->setDefaults([
  59.             'compound' => true,
  60.         ]);
  61.     }
  62. }