1
|
|
|
<?php |
2
|
|
|
/*************************************************************************************/ |
3
|
|
|
/* This file is part of the Thelia package. */ |
4
|
|
|
/* */ |
5
|
|
|
/* Copyright (c) OpenStudio */ |
6
|
|
|
/* email : [email protected] */ |
7
|
|
|
/* web : http://www.thelia.net */ |
8
|
|
|
/* */ |
9
|
|
|
/* For the full copyright and license information, please view the LICENSE.txt */ |
10
|
|
|
/* file that was distributed with this source code. */ |
11
|
|
|
/*************************************************************************************/ |
12
|
|
|
/*************************************************************************************/ |
13
|
|
|
|
14
|
|
|
namespace Dealer\Form; |
15
|
|
|
|
16
|
|
|
use Dealer\Dealer; |
17
|
|
|
use Symfony\Component\Validator\Constraints\NotBlank; |
18
|
|
|
use Thelia\Form\BaseForm; |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* Class ContactForm |
22
|
|
|
* @package Dealer\Form |
23
|
|
|
*/ |
24
|
|
|
class ContactForm extends BaseForm |
25
|
|
|
{ |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* |
29
|
|
|
* in this function you add all the fields you need for your Form. |
30
|
|
|
* Form this you have to call add method on $this->formBuilder attribute : |
31
|
|
|
* |
32
|
|
|
* $this->formBuilder->add("name", "text") |
33
|
|
|
* ->add("email", "email", array( |
34
|
|
|
* "attr" => array( |
35
|
|
|
* "class" => "field" |
36
|
|
|
* ), |
37
|
|
|
* "label" => "email", |
38
|
|
|
* "constraints" => array( |
39
|
|
|
* new \Symfony\Component\Validator\Constraints\NotBlank() |
40
|
|
|
* ) |
41
|
|
|
* ) |
42
|
|
|
* ) |
43
|
|
|
* ->add('age', 'integer'); |
44
|
|
|
* |
45
|
|
|
* @return null |
46
|
|
|
*/ |
47
|
|
|
protected function buildForm() |
48
|
|
|
{ |
49
|
|
|
$this->formBuilder |
50
|
|
|
->add("label", "text", array( |
51
|
|
|
"label" => $this->translator->trans("Label", [], Dealer::MESSAGE_DOMAIN), |
52
|
|
|
"label_attr" => ["for" => "attr-dealer-contact-label"], |
53
|
|
|
"required" => true, |
54
|
|
|
"constraints" => array(new NotBlank(), ), |
55
|
|
|
"attr" => array() |
56
|
|
|
)) |
57
|
|
|
->add('dealer_id', 'integer', array( |
58
|
|
|
"label" => $this->translator->trans("Dealer", [], Dealer::MESSAGE_DOMAIN), |
59
|
|
|
"label_attr" => ["for" => "attr-dealer-contact-dealer_id"], |
60
|
|
|
"required" => true, |
61
|
|
|
"constraints" => array(new NotBlank(), ), |
62
|
|
|
"attr" => array() |
63
|
|
|
)) |
64
|
|
|
->add("locale", "text", array( |
65
|
|
|
"constraints" => array( |
66
|
|
|
new NotBlank(), |
67
|
|
|
), |
68
|
|
|
"label_attr" => array("for" => "locale_create"), |
69
|
|
|
)) |
70
|
|
|
; |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
public function getName() |
74
|
|
|
{ |
75
|
|
|
return "contact_create"; |
76
|
|
|
} |
77
|
|
|
} |
78
|
|
|
|