deblan.tv/vendor/trinity/src/Trinity/Bundle/ContactBundle/Form/Type/ContactType.php
2015-03-02 21:57:49 +01:00

88 lines
2.1 KiB
PHP
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?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(),
),
)
);
}
}