88 lines
2.1 KiB
PHP
88 lines
2.1 KiB
PHP
<?php
|
||
|
||
namespace Trinity\Bundle\ContactBundle\Form\Type;
|
||
|
||
use Propel\PropelBundle\Form\BaseAbstractType;
|
||
use Symfony\Component\Form\FormBuilderInterface;
|
||
use Symfony\Component\Validator\Constraints\NotBlank;
|
||
use Symfony\Component\Validator\Constraints\Email;
|
||
|
||
class ContactType extends BaseAbstractType
|
||
{
|
||
protected $options = array(
|
||
'data_class' => 'Trinity\Bundle\ContactBundle\Model\Contact',
|
||
'name' => 'contact',
|
||
);
|
||
|
||
/**
|
||
* {@inheritdoc}
|
||
*/
|
||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||
{
|
||
$builder->add(
|
||
'name',
|
||
'text',
|
||
array(
|
||
'required' => true,
|
||
'attr' => array(
|
||
'placeholder' => 'Nom',
|
||
),
|
||
'constraints' => array(
|
||
new NotBlank(),
|
||
),
|
||
)
|
||
);
|
||
|
||
$builder->add(
|
||
'firm',
|
||
'text',
|
||
array(
|
||
'required' => false,
|
||
'attr' => array(
|
||
'placeholder' => 'Société',
|
||
),
|
||
)
|
||
);
|
||
|
||
$builder->add(
|
||
'phone',
|
||
'text',
|
||
array(
|
||
'required' => false,
|
||
'attr' => array(
|
||
'placeholder' => 'Téléphone',
|
||
),
|
||
)
|
||
);
|
||
|
||
$builder->add(
|
||
'email',
|
||
'email',
|
||
array(
|
||
'required' => true,
|
||
'attr' => array(
|
||
'placeholder' => 'E-mail',
|
||
),
|
||
'constraints' => array(
|
||
new NotBlank(),
|
||
new Email(),
|
||
),
|
||
)
|
||
);
|
||
|
||
$builder->add(
|
||
'message',
|
||
'textarea',
|
||
array(
|
||
'required' => true,
|
||
'attr' => array(
|
||
'placeholder' => 'Message',
|
||
),
|
||
'constraints' => array(
|
||
new NotBlank(),
|
||
),
|
||
)
|
||
);
|
||
}
|
||
}
|