src/Backend/Modules/Editions/Domain/AddressType.php line 11

Open in your IDE?
  1. <?php
  2. namespace Backend\Modules\Editions\Domain;
  3. use Symfony\Component\Form\AbstractType;
  4. use Symfony\Component\Form\Extension\Core\Type\CountryType;
  5. use Symfony\Component\Form\Extension\Core\Type\TextType;
  6. use Symfony\Component\Form\FormBuilderInterface;
  7. use Symfony\Component\OptionsResolver\OptionsResolver;
  8. class AddressType extends AbstractType
  9. {
  10.     public function buildForm(FormBuilderInterface $builder, array $options): void
  11.     {
  12.         $builder
  13.             ->add(
  14.                 'street',
  15.                 TextType::class,
  16.                 [
  17.                     'label' => 'lbl.Street',
  18.                     'attr' => [
  19.                         'data-role' => 'graydonAddress'
  20.                     ],
  21.                 ]
  22.             )
  23.             ->add(
  24.                 'postalCode',
  25.                 TextType::class,
  26.                 [
  27.                     'label' => 'lbl.PostalCode',
  28.                     'attr' => [
  29.                         'data-role' => 'postal-code-field'
  30.                     ],
  31.                 ]
  32.             )
  33.             ->add(
  34.                 'city',
  35.                 TextType::class,
  36.                 [
  37.                     'label' => 'lbl.City',
  38.                     'attr' => [
  39.                         'data-role' => 'graydonCity'
  40.                     ],
  41.                 ]
  42.             )
  43.             ->add(
  44.                 'country',
  45.                 CountryType::class,
  46.                 [
  47.                     'label' => 'lbl.Country',
  48.                     'placeholder' => '',
  49.                 ]
  50.             );
  51.     }
  52.     public function configureOptions(OptionsResolver $resolver): void
  53.     {
  54.         $resolver->setDefaults(
  55.             [
  56.                 'data_class' => AddressDataTransferObject::class,
  57.             ]
  58.         );
  59.     }
  60. }