how do you put the class to the easyadmin form row in symfony 3?

0

I have a question about the easyadmin twig and the customization of the properties when a form is made with the builder.

I have this in the easyadmin configurator:

easy_admin:
    entities:        
        Matriculasinconfirmar:
            templates:

            class: AppBundle\Entity\Matricula
            controller: AppBundle\Controller\Admin\MatriculaController
            disabled_actions: ['new']
            list:
                title: 'Matrículas'
                actions: ['edit', '-delete']
                fields:
                    - { property: 'codigo', label: 'Código' }
            form:
                title: 'Gestionar Matrícula'
                fields:
                    - { property: 'fecha', label: 'Fecha matrícula', css_class: 'col-lg-6'}
                    - { property: 'modeloContrato', label: 'Modelo del contrato', css_class: 'col-lg-6'}
                    - { property: 'pagos', label: false,  type: 'collection', type_options: { entry_type: 'AppBundle\Form\PagoType', by_reference: false, allow_delete: true, entry_options: {label: false} } }

And in the PagoType file:

namespace AppBundle\Form;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Form\Extension\Core\Type\DateType;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use AppBundle\Entity\FormaPago;

class PagoType extends AbstractType
{
    /**
     * {@inheritdoc}
     */
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder->add
                    ('forma', EntityType::class , 
                        ['class' => 'AppBundle:FormaPago',
                        'query_builder' =>  'AppBundle\Repository\FormaPagoRepository::getSelect',
                        'group_by' => 'padre',
                        'attr' => array('class' => 'col-especial'),
                        'label'  => 'Forma de pago']
                    )
                ->add('PagoEfectivo')
                ->add('PagoTarjeta')
                ->add('PagoTransferencia')
                ;
    }

    /**
     * {@inheritdoc}
     */
    public function configureOptions(OptionsResolver $resolver)
    {
        $resolver->setDefaults(array(
            'data_class' => 'AppBundle\Entity\Pago'
        ));
    }

    /**
     * {@inheritdoc}
     */
    public function getBlockPrefix()
    {
        return 'appbundle_pago';
    }


}

The problem is that when I render the view it looks like this:

<div class="form-group  field-entity">
   <label class="control-label" for="matriculasinconfirmar_pagos_0_forma">
      Forma de pago
   </label>
   <select id="matriculasinconfirmar_pagos_0_forma" name="matriculasinconfirmar[pagos][0][forma]" class="col-especial form-control">
      <option value="2" selected="selected">Contado 1</option>
      <option value="3">Contado 2</option>
   </select>            
</div>

What I get is that col-especial , it comes out in the select instead of in the row of the form and I would like it to be like this:

<div class="col-especial  form-group  field-entity">
   <label class="control-label" for="matriculasinconfirmar_pagos_0_forma">
      Forma de pago
   </label>
   <select id="matriculasinconfirmar_pagos_0_forma" name="matriculasinconfirmar[pagos][0][forma]" class="form-control">
      <option value="2" selected="selected">Contado 1</option>
      <option value="3">Contado 2</option>
   </select>            
</div>

Thanks in advance

    
asked by Sergio Ibañez 27.12.2018 в 11:13
source

0 answers