1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- <?php
- namespace App\Form;
- use Symfony\Component\Form\Extension\Core\Type\NumberType;
- use Symfony\Component\Form\AbstractType;
- use Symfony\Component\Form\Extension\Core\Type\TextareaType;
- use Symfony\Component\Form\FormBuilderInterface;
- use Symfony\Component\OptionsResolver\OptionsResolver;
- use Symfony\Component\Form\Extension\Core\Type\SubmitType;
- class CommentaireType extends AbstractType
- {
- /**
- * {@inheritdoc}
- */
- public function buildForm(FormBuilderInterface $builder, array $options)
- {
- $builder
- ->add('note', NumberType::class, array (
- 'required' => false,
- 'label' => false,
- 'attr' => array (
- 'min' => 0,
- 'max' => 5,
- 'class' => "rating",
- 'data-step' => 1,
- 'data-show-clear' => "true",
- 'data-show-caption' => "false",
- 'data-size' => "sm",
- 'data-theme' => "krajee-fa"
- )
- ))
- ->add('contenu', TextareaType::class, array(
- 'required' => false,
- 'label' => false
- ))
- ->add('save', SubmitType::class, array(
- 'label' => 'Enregistrer le commentaire',
- 'attr'=>array(
- 'class' => 'btn-primary'
- )));
- }
-
- /**
- * {@inheritdoc}
- */
- public function configureOptions(OptionsResolver $resolver)
- {
- $resolver->setDefaults(array(
- 'data_class' => 'App\Entity\Commentaire'
- ));
- }
- /**
- * {@inheritdoc}
- */
- public function getBlockPrefix() : string
- {
- return 'App_commentaire';
- }
- }
|