1 | <?php |
||
27 | class FieldService implements SingletonInterface |
||
28 | { |
||
29 | /** |
||
30 | * @var Field |
||
31 | */ |
||
32 | protected $currentField; |
||
33 | |||
34 | /** |
||
35 | * @var array |
||
36 | */ |
||
37 | protected $fieldOptions = []; |
||
38 | |||
39 | /** |
||
40 | * Unique instance of view, stored to save some performance. |
||
41 | * |
||
42 | * @var StandaloneView |
||
43 | */ |
||
44 | protected $view; |
||
45 | |||
46 | /** |
||
47 | * Reset every state that can be used by this service. |
||
48 | */ |
||
49 | public function resetState() |
||
53 | |||
54 | /** |
||
55 | * Checks that the `FieldViewHelper` has been called. If not, an exception |
||
56 | * is thrown. |
||
57 | * |
||
58 | * @return bool |
||
59 | */ |
||
60 | public function fieldContextExists() |
||
64 | |||
65 | /** |
||
66 | * Returns the current field which was defined by the `FieldViewHelper`. |
||
67 | * |
||
68 | * Returns null if no current field was found. |
||
69 | * |
||
70 | * @return Field|null |
||
71 | */ |
||
72 | public function getCurrentField() |
||
76 | |||
77 | /** |
||
78 | * @param Field $field |
||
79 | */ |
||
80 | public function setCurrentField(Field $field) |
||
84 | |||
85 | /** |
||
86 | * @param string $name |
||
87 | * @param mixed $value |
||
88 | */ |
||
89 | public function setFieldOption($name, $value) |
||
93 | |||
94 | /** |
||
95 | * @return array |
||
96 | */ |
||
97 | public function getFieldOptions() |
||
101 | |||
102 | /** |
||
103 | * @return $this |
||
104 | */ |
||
105 | public function resetFieldOptions() |
||
111 | |||
112 | /** |
||
113 | * Unset the current field. |
||
114 | * |
||
115 | * @return $this |
||
116 | */ |
||
117 | public function removeCurrentField() |
||
123 | |||
124 | /** |
||
125 | * Checks that the `FieldViewHelper` has been called. If not, an exception |
||
126 | * is thrown. |
||
127 | * |
||
128 | * @throws \Exception |
||
129 | */ |
||
130 | public function checkIsInsideFieldViewHelper() |
||
139 | |||
140 | /** |
||
141 | * @return StandaloneView |
||
142 | */ |
||
143 | public function getView() |
||
151 | } |
||
152 |