Voici votre URL de partage https://sharemycode.io/c/14950f6eb0 (Cliquer pour copier) (Copié)

<?php

namespace App\Form\Front\listingProjects;

use App\Entity\Filters;
use App\Entity\ListingProjects;
use Doctrine\ORM\EntityRepository;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;


class AddListingProjectsType extends AbstractType
{
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add('domainname', TextType::class, [
                'label' => 'Nom de domaine :',
                'attr' => ['placeholder' => 'www.site.fr'],
                'required' => true,
                'label_attr' => ['class' => 'color-yellow'],
            ])
            ->add('name', EntityType::class, array(
                'required' => true,
                'label' => false,
                'choice_label' => fn (Filters $filter) => $filter->getName(),
                'class' => Filters::class,
                'expanded' => true,
                'multiple' => false,
                'label_attr' => ['class' => 'color-white'],
            ))
            ->add('websitetype', ChoiceType::class, [
                'label' => 'Type de site :',
                'choices' => ['Site vitrine' => 'Site vitrine', 'E-commerce' => 'E-commerce'],
                'required' => true,
                'label_attr' => ['class' => 'color-yellow'],
            ])

            ->add('submit', SubmitType::class, [
                'label' => 'Enregistrer',
                'attr' => ['class' => 'btn-submit'],
            ]);
    }

    public function configureOptions(OptionsResolver $resolver)
    {
        $resolver->setDefaults([
            'data_class' => ListingProjects::class,
        ]);
    }
}

Informations

Cet extrait a été créé le 24 nov. 2022 à 16:52:29

Cet extrait expire le 24 déc. 2022 à 16:52:29

Langage : php

Logo php

Code ajouté par KaeligB

Link

Voici votre URL de partage : https://sharemycode.io/c/14950f6eb0 Copié