src/Form/Frontal/SearchType.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Form\Frontal;
  3. use Symfony\Component\Form\AbstractType;
  4. use Symfony\Component\Form\FormBuilderInterface;
  5. use Symfony\Component\OptionsResolver\OptionsResolver;
  6. use Symfony\Component\Form\Extension\Core\Type\TextType;
  7. use Symfony\Component\Form\Extension\Core\Type\SubmitType;
  8. class SearchType extends AbstractType
  9. {
  10.     public function buildForm(FormBuilderInterface $builder, array $options)
  11.     {
  12.         $builder->add('query'TextType::class, array(
  13.             'label' => 'Email',
  14.             'trim' => true,
  15.             'mapped' => false,
  16.             'error_bubbling' => true,
  17.             'attr' => [
  18.                 'minlength' => 4,
  19.                 'maxlength' => 30,
  20.                 'placeholder' => 'Buscar noticias'
  21.             ]
  22.         ))->
  23.         setAction($options['action'])->
  24.         add('send'SubmitType::class, array('label' => 'Buscar'));
  25.         return $builder;
  26.     }
  27.     /**
  28.      * {@inheritdoc}
  29.      */
  30.     public function configureOptions(OptionsResolver $resolver)
  31.     {
  32.         $resolver->setDefaults(array(
  33.             'data_class' => null,
  34.             'lang' => null
  35.         ));
  36.     }
  37. }