1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace LAG\AdminBundle\Field; |
4
|
|
|
|
5
|
|
|
use LAG\AdminBundle\Admin\Configuration\ApplicationConfiguration; |
6
|
|
|
use Symfony\Component\Translation\TranslatorInterface; |
7
|
|
|
use Twig_Environment; |
8
|
|
|
|
9
|
|
|
abstract class Field implements FieldInterface, TranslatableFieldInterface, TwigFieldInterface |
10
|
|
|
{ |
11
|
|
|
const TYPE_STRING = 'string'; |
12
|
|
|
const TYPE_LINK = 'link'; |
13
|
|
|
const TYPE_ARRAY = 'array'; |
14
|
|
|
const TYPE_DATE = 'date'; |
15
|
|
|
const TYPE_COUNT = 'count'; |
16
|
|
|
const TYPE_ACTION = 'action'; |
17
|
|
|
const TYPE_COLLECTION = 'collection'; |
18
|
|
|
const TYPE_BOOLEAN = 'boolean'; |
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* Name of the field. |
22
|
|
|
* |
23
|
|
|
* @var string |
24
|
|
|
*/ |
25
|
|
|
protected $name; |
26
|
|
|
|
27
|
|
|
/** |
28
|
|
|
* @var ApplicationConfiguration |
29
|
|
|
*/ |
30
|
|
|
protected $configuration; |
31
|
|
|
|
32
|
|
|
/** |
33
|
|
|
* Twig engine. |
34
|
|
|
* |
35
|
|
|
* @var Twig_Environment |
36
|
|
|
*/ |
37
|
|
|
protected $twig; |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* Translator. |
41
|
|
|
* |
42
|
|
|
* @var TranslatorInterface |
43
|
|
|
*/ |
44
|
|
|
protected $translator; |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* @return string |
48
|
|
|
*/ |
49
|
1 |
|
public function getName() |
50
|
|
|
{ |
51
|
1 |
|
return $this->name; |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
/** |
55
|
|
|
* @param string $name |
56
|
|
|
*/ |
57
|
1 |
|
public function setName($name) |
58
|
|
|
{ |
59
|
1 |
|
$this->name = $name; |
60
|
1 |
|
} |
61
|
|
|
|
62
|
|
|
/** |
63
|
|
|
* @return ApplicationConfiguration |
64
|
|
|
*/ |
65
|
|
|
public function getConfiguration() |
66
|
|
|
{ |
67
|
|
|
return $this->configuration; |
68
|
|
|
} |
69
|
|
|
|
70
|
|
|
/** |
71
|
|
|
* @param ApplicationConfiguration $configuration |
72
|
|
|
*/ |
73
|
|
|
public function setConfiguration($configuration) |
74
|
|
|
{ |
75
|
|
|
$this->configuration = $configuration; |
76
|
|
|
} |
77
|
|
|
|
78
|
|
|
/** |
79
|
|
|
* @param Twig_Environment $twig |
80
|
|
|
*/ |
81
|
|
|
public function setTwig(Twig_Environment $twig) |
82
|
|
|
{ |
83
|
|
|
$this->twig = $twig; |
84
|
|
|
} |
85
|
|
|
|
86
|
|
|
/** |
87
|
|
|
* @param TranslatorInterface $translator |
88
|
|
|
*/ |
89
|
|
|
public function setTranslator(TranslatorInterface $translator) |
90
|
|
|
{ |
91
|
|
|
$this->translator = $translator; |
92
|
|
|
} |
93
|
|
|
} |
94
|
|
|
|