<?php
namespace App\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\EmailType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Validator\Constraints as Assert;
class NameAddressBlockType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add('name', TextType::class, [
'label' => false,
'required' => true,
'attr' => [
'placeholder' => 'Name',
],
])
->add('street', TextType::class, [
'label' => false,
'required' => true,
'attr' => [
'placeholder' => 'Strasse',
],
])
->add('zip', TextType::class, [
'label' => false,
'required' => true,
'constraints' => [
new Assert\Length(['max' => 30]),
],
'attr' => [
'placeholder' => 'PLZ',
'maxlength' => '30',
],
])
->add('city', TextType::class, [
'label' => false,
'required' => true,
'attr' => [
'placeholder' => 'Ort',
],
])
->add('phone', TextType::class, [
'label' => false,
'required' => false,
'attr' => [
'placeholder' => 'Telefon',
],
])
->add('email', EmailType::class, [
'label' => false,
'required' => false,
'attr' => [
'placeholder' => 'Email',
],
])
;
}
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
]);
}
}