Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
8.15% |
15 / 184 |
|
2.11% |
2 / 95 |
CRAP | |
0.00% |
0 / 1 |
SubFormState | |
8.15% |
15 / 184 |
|
2.11% |
2 / 95 |
9485.45 | |
0.00% |
0 / 1 |
__construct | |
100.00% |
14 / 14 |
|
100.00% |
1 / 1 |
5 | |||
applySubKeys | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getCompleteForm | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setCompleteForm | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
2 | |||
loadInclude | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getCacheableArray | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setFormState | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
6 | |||
setResponse | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
getResponse | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setRedirect | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
setRedirectUrl | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
getRedirect | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setStorage | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
getStorage | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
get | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
6 | |||
set | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
6 | |||
has | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
6 | |||
setBuildInfo | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
getBuildInfo | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
addBuildInfo | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
getUserInput | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
setUserInput | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
2 | |||
getValues | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getValue | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
6 | |||
setValues | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
setValue | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
unsetValue | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
hasValue | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
6 | |||
isValueEmpty | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
6 | |||
setValueForElement | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
hasAnyErrors | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setErrorByName | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
setError | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
clearErrors | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getErrors | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getError | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setRebuild | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
isRebuilding | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setInvalidToken | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
hasInvalidToken | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
prepareCallback | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getFormObject | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setFormObject | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
setAlwaysProcess | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
getAlwaysProcess | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setButtons | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
getButtons | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setCached | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
isCached | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
disableCache | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
setExecuted | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
isExecuted | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setGroups | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
getGroups | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setHasFileElement | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
hasFileElement | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setLimitValidationErrors | |
0.00% |
0 / 6 |
|
0.00% |
0 / 1 |
2 | |||
getLimitValidationErrors | |
0.00% |
0 / 11 |
|
0.00% |
0 / 1 |
30 | |||
setMethod | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
setRequestMethod | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
isMethodType | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setValidationEnforced | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
isValidationEnforced | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
disableRedirect | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
isRedirectDisabled | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setProcessInput | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
isProcessingInput | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setProgrammed | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
isProgrammed | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setProgrammedBypassAccessCheck | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
isBypassingProgrammedAccessChecks | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setRebuildInfo | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
getRebuildInfo | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
addRebuildInfo | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
setSubmitHandlers | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
getSubmitHandlers | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setSubmitted | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
isSubmitted | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setTemporary | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
getTemporary | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getTemporaryValue | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setTemporaryValue | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
hasTemporaryValue | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setTriggeringElement | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
getTriggeringElement | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setValidateHandlers | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
getValidateHandlers | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setValidationComplete | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
isValidationComplete | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getCleanValueKeys | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
setCleanValueKeys | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
addCleanValueKey | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
cleanValues | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
setIgnoreDestination | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
2 | |||
getIgnoreDestination | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | |
3 | declare(strict_types=1); |
4 | |
5 | namespace Drupal\authorization\Form; |
6 | |
7 | use Drupal\Component\Utility\NestedArray; |
8 | use Drupal\Core\Form\FormInterface; |
9 | use Drupal\Core\Form\FormState; |
10 | use Drupal\Core\Form\FormStateInterface; |
11 | use Drupal\Core\Url; |
12 | use Symfony\Component\HttpFoundation\Response; |
13 | |
14 | /** |
15 | * Represents the form state of a sub-form. |
16 | */ |
17 | class SubFormState implements FormStateInterface { |
18 | |
19 | /** |
20 | * The keys which should be inherited as-is from the main form state. |
21 | * |
22 | * @var bool[] |
23 | */ |
24 | protected static $inheritedKeys = [ |
25 | 'build_info' => TRUE, |
26 | 'rebuild_info' => TRUE, |
27 | 'rebuild' => TRUE, |
28 | 'response' => TRUE, |
29 | 'redirect' => TRUE, |
30 | 'redirect_route' => TRUE, |
31 | 'no_redirect' => TRUE, |
32 | 'method' => TRUE, |
33 | 'cache' => TRUE, |
34 | 'no_cache' => TRUE, |
35 | 'triggering_element' => TRUE, |
36 | ]; |
37 | |
38 | /** |
39 | * The form state of the main form. |
40 | * |
41 | * @var \Drupal\Core\Form\FormStateInterface |
42 | */ |
43 | protected $mainFormState; |
44 | |
45 | /** |
46 | * The keys that lead to the desired sub-form in the main form. |
47 | * |
48 | * @var string[] |
49 | */ |
50 | protected $subKeys; |
51 | |
52 | /** |
53 | * Internal storage for the sub-state, writing into the main form state. |
54 | * |
55 | * @var array |
56 | */ |
57 | protected $internalStorage; |
58 | |
59 | /** |
60 | * The values of the sub-form. |
61 | * |
62 | * @var array |
63 | */ |
64 | protected $values; |
65 | |
66 | /** |
67 | * The input of the sub-form. |
68 | * |
69 | * @var array |
70 | */ |
71 | protected $input; |
72 | |
73 | /** |
74 | * Constructs a SubFormState object. |
75 | * |
76 | * @param \Drupal\Core\Form\FormStateInterface $main_form_state |
77 | * The state of the main form. |
78 | * @param string[] $sub_keys |
79 | * The keys that lead to the desired sub-form in the main form. |
80 | */ |
81 | public function __construct(FormStateInterface $main_form_state, array $sub_keys) { |
82 | $this->mainFormState = $main_form_state; |
83 | $this->subKeys = $sub_keys; |
84 | $sub_state = &$main_form_state->get('sub_states'); |
85 | if (!isset($sub_state)) { |
86 | $sub_state = []; |
87 | } |
88 | $this->internalStorage = &$this->applySubKeys($sub_state); |
89 | if (!isset($this->internalStorage)) { |
90 | $this->internalStorage = []; |
91 | } |
92 | $this->values = &$this->applySubKeys($main_form_state->getValues()); |
93 | if (!is_array($this->values)) { |
94 | $this->values = []; |
95 | } |
96 | $this->input = &$this->applySubKeys($main_form_state->getUserInput()); |
97 | if (!is_array($this->input)) { |
98 | $this->input = []; |
99 | } |
100 | } |
101 | |
102 | /** |
103 | * Applies the sub-form's array keys to the given original array. |
104 | * |
105 | * @param array $original |
106 | * The original array, belonging to the main form. |
107 | * |
108 | * @return array|null |
109 | * The corresponding array for the sub form, as a reference. |
110 | */ |
111 | protected function &applySubKeys(array &$original): ?array { |
112 | return NestedArray::getValue($original, $this->subKeys); |
113 | } |
114 | |
115 | /** |
116 | * {@inheritdoc} |
117 | */ |
118 | public function &getCompleteForm(): array { |
119 | return $this->applySubKeys($this->mainFormState->getCompleteForm()); |
120 | } |
121 | |
122 | /** |
123 | * {@inheritdoc} |
124 | */ |
125 | public function setCompleteForm(array &$complete_form) { |
126 | $sub_form = &$this->applySubKeys($this->mainFormState->getCompleteForm()); |
127 | $sub_form = $complete_form; |
128 | return $this; |
129 | } |
130 | |
131 | /** |
132 | * {@inheritdoc} |
133 | */ |
134 | public function loadInclude($module, $type, $name = NULL) { |
135 | return $this->mainFormState->loadInclude($module, $type, $name); |
136 | } |
137 | |
138 | /** |
139 | * {@inheritdoc} |
140 | */ |
141 | public function getCacheableArray(): array { |
142 | return []; |
143 | } |
144 | |
145 | /** |
146 | * {@inheritdoc} |
147 | */ |
148 | public function setFormState(array $form_state_additions) { |
149 | foreach ($form_state_additions as $key => $value) { |
150 | $this->set($key, $value); |
151 | } |
152 | return $this; |
153 | } |
154 | |
155 | /** |
156 | * {@inheritdoc} |
157 | */ |
158 | public function setResponse(Response $response) { |
159 | $this->mainFormState->setResponse($response); |
160 | return $this; |
161 | } |
162 | |
163 | /** |
164 | * {@inheritdoc} |
165 | */ |
166 | public function getResponse(): ?Response { |
167 | return $this->mainFormState->getResponse(); |
168 | } |
169 | |
170 | /** |
171 | * {@inheritdoc} |
172 | */ |
173 | public function setRedirect($route_name, array $route_parameters = [], array $options = []) { |
174 | $this->mainFormState->setRedirect($route_name, $route_parameters, $options); |
175 | return $this; |
176 | } |
177 | |
178 | /** |
179 | * {@inheritdoc} |
180 | */ |
181 | public function setRedirectUrl(Url $url) { |
182 | $this->mainFormState->setRedirectUrl($url); |
183 | return $this; |
184 | } |
185 | |
186 | /** |
187 | * {@inheritdoc} |
188 | */ |
189 | public function getRedirect() { |
190 | return $this->mainFormState->getRedirect(); |
191 | } |
192 | |
193 | /** |
194 | * {@inheritdoc} |
195 | */ |
196 | public function setStorage(array $storage) { |
197 | $this->internalStorage = $storage; |
198 | return $this; |
199 | } |
200 | |
201 | /** |
202 | * {@inheritdoc} |
203 | */ |
204 | public function &getStorage() { |
205 | return $this->internalStorage; |
206 | } |
207 | |
208 | /** |
209 | * {@inheritdoc} |
210 | */ |
211 | public function &get($property) { |
212 | if (isset(self::$inheritedKeys[$property])) { |
213 | return $this->mainFormState->get($property); |
214 | } |
215 | $value = &NestedArray::getValue($this->internalStorage, (array) $property); |
216 | return $value; |
217 | } |
218 | |
219 | /** |
220 | * {@inheritdoc} |
221 | */ |
222 | public function set($property, $value) { |
223 | if (isset(self::$inheritedKeys[$property])) { |
224 | $this->mainFormState->set($property, $value); |
225 | } |
226 | else { |
227 | $this->internalStorage[$property] = $value; |
228 | } |
229 | return $this; |
230 | } |
231 | |
232 | /** |
233 | * {@inheritdoc} |
234 | */ |
235 | public function has($property) { |
236 | return isset(self::$inheritedKeys[$property]) |
237 | || array_key_exists($property, $this->internalStorage); |
238 | } |
239 | |
240 | /** |
241 | * {@inheritdoc} |
242 | */ |
243 | public function setBuildInfo(array $build_info) { |
244 | $this->mainFormState->setBuildInfo($build_info); |
245 | return $this; |
246 | } |
247 | |
248 | /** |
249 | * {@inheritdoc} |
250 | */ |
251 | public function getBuildInfo() { |
252 | return $this->mainFormState->getBuildInfo(); |
253 | } |
254 | |
255 | /** |
256 | * {@inheritdoc} |
257 | */ |
258 | public function addBuildInfo($property, $value) { |
259 | $this->mainFormState->addBuildInfo($property, $value); |
260 | return $this; |
261 | } |
262 | |
263 | /** |
264 | * {@inheritdoc} |
265 | */ |
266 | public function &getUserInput() { |
267 | $user_input = &$this->mainFormState->getUserInput(); |
268 | return $this->applySubKeys($user_input); |
269 | } |
270 | |
271 | /** |
272 | * {@inheritdoc} |
273 | */ |
274 | public function setUserInput(array $user_input) { |
275 | $old = &$this->getUserInput(); |
276 | $old = $user_input; |
277 | return $this; |
278 | } |
279 | |
280 | /** |
281 | * {@inheritdoc} |
282 | */ |
283 | public function &getValues() { |
284 | return $this->values; |
285 | } |
286 | |
287 | /** |
288 | * {@inheritdoc} |
289 | */ |
290 | public function &getValue($key, $default = NULL) { |
291 | if ($this->hasValue($key)) { |
292 | return $this->values[$key]; |
293 | } |
294 | } |
295 | |
296 | /** |
297 | * {@inheritdoc} |
298 | */ |
299 | public function setValues(array $values) { |
300 | $this->values = $values; |
301 | return $this; |
302 | } |
303 | |
304 | /** |
305 | * {@inheritdoc} |
306 | */ |
307 | public function setValue($key, $value) { |
308 | $this->values[$key] = $value; |
309 | return $this; |
310 | } |
311 | |
312 | /** |
313 | * {@inheritdoc} |
314 | */ |
315 | public function unsetValue($key) { |
316 | unset($this->values[$key]); |
317 | return $this; |
318 | } |
319 | |
320 | /** |
321 | * {@inheritdoc} |
322 | */ |
323 | public function hasValue($key) { |
324 | if (isset($this->values[$key])) { |
325 | return TRUE; |
326 | } |
327 | return FALSE; |
328 | } |
329 | |
330 | /** |
331 | * {@inheritdoc} |
332 | */ |
333 | public function isValueEmpty($key) { |
334 | if (empty($this->values[$key])) { |
335 | return TRUE; |
336 | } |
337 | return FALSE; |
338 | } |
339 | |
340 | /** |
341 | * {@inheritdoc} |
342 | */ |
343 | public function setValueForElement(array $element, $value) { |
344 | $this->mainFormState->setValueForElement($element, $value); |
345 | return $this; |
346 | } |
347 | |
348 | /** |
349 | * {@inheritdoc} |
350 | */ |
351 | public static function hasAnyErrors() { |
352 | return FormState::hasAnyErrors(); |
353 | } |
354 | |
355 | /** |
356 | * {@inheritdoc} |
357 | */ |
358 | public function setErrorByName($name, $message = '') { |
359 | $this->mainFormState->setErrorByName(implode('][', $this->subKeys) . '][' . $name, $message); |
360 | return $this; |
361 | } |
362 | |
363 | /** |
364 | * {@inheritdoc} |
365 | */ |
366 | public function setError(array &$element, $message = '') { |
367 | $this->mainFormState->setError($element, $message); |
368 | return $this; |
369 | } |
370 | |
371 | /** |
372 | * {@inheritdoc} |
373 | */ |
374 | public function clearErrors() { |
375 | $this->mainFormState->clearErrors(); |
376 | } |
377 | |
378 | /** |
379 | * {@inheritdoc} |
380 | */ |
381 | public function getErrors() { |
382 | return $this->mainFormState->getErrors(); |
383 | } |
384 | |
385 | /** |
386 | * {@inheritdoc} |
387 | */ |
388 | public function getError(array $element) { |
389 | return $this->mainFormState->getError($element); |
390 | } |
391 | |
392 | /** |
393 | * {@inheritdoc} |
394 | */ |
395 | public function setRebuild($rebuild = TRUE) { |
396 | $this->mainFormState->setRebuild($rebuild); |
397 | return $this; |
398 | } |
399 | |
400 | /** |
401 | * {@inheritdoc} |
402 | */ |
403 | public function isRebuilding() { |
404 | return $this->mainFormState->isRebuilding(); |
405 | } |
406 | |
407 | /** |
408 | * {@inheritdoc} |
409 | */ |
410 | public function setInvalidToken($invalid_token) { |
411 | $this->mainFormState->setInvalidToken($invalid_token); |
412 | return $this; |
413 | } |
414 | |
415 | /** |
416 | * {@inheritdoc} |
417 | */ |
418 | public function hasInvalidToken() { |
419 | return $this->mainFormState->hasInvalidToken(); |
420 | } |
421 | |
422 | /** |
423 | * {@inheritdoc} |
424 | */ |
425 | public function prepareCallback($callback) { |
426 | return $this->mainFormState->prepareCallback($callback); |
427 | } |
428 | |
429 | /** |
430 | * {@inheritdoc} |
431 | */ |
432 | public function getFormObject() { |
433 | return $this->mainFormState->getFormObject(); |
434 | } |
435 | |
436 | /** |
437 | * {@inheritdoc} |
438 | */ |
439 | public function setFormObject(FormInterface $form_object) { |
440 | $this->mainFormState->setFormObject($form_object); |
441 | return $this; |
442 | } |
443 | |
444 | /** |
445 | * {@inheritdoc} |
446 | */ |
447 | public function setAlwaysProcess($always_process = TRUE) { |
448 | $this->mainFormState->setAlwaysProcess($always_process); |
449 | return $this; |
450 | } |
451 | |
452 | /** |
453 | * {@inheritdoc} |
454 | */ |
455 | public function getAlwaysProcess() { |
456 | return $this->mainFormState->getAlwaysProcess(); |
457 | } |
458 | |
459 | /** |
460 | * {@inheritdoc} |
461 | */ |
462 | public function setButtons(array $buttons) { |
463 | $this->mainFormState->setButtons($buttons); |
464 | return $this; |
465 | } |
466 | |
467 | /** |
468 | * {@inheritdoc} |
469 | */ |
470 | public function getButtons() { |
471 | return $this->mainFormState->getButtons(); |
472 | } |
473 | |
474 | /** |
475 | * {@inheritdoc} |
476 | */ |
477 | public function setCached($cache = TRUE) { |
478 | $this->mainFormState->setCached($cache); |
479 | return $this; |
480 | } |
481 | |
482 | /** |
483 | * {@inheritdoc} |
484 | */ |
485 | public function isCached() { |
486 | return $this->mainFormState->isCached(); |
487 | } |
488 | |
489 | /** |
490 | * {@inheritdoc} |
491 | */ |
492 | public function disableCache() { |
493 | $this->mainFormState->disableCache(); |
494 | return $this; |
495 | } |
496 | |
497 | /** |
498 | * {@inheritdoc} |
499 | */ |
500 | public function setExecuted() { |
501 | $this->mainFormState->setExecuted(); |
502 | return $this; |
503 | } |
504 | |
505 | /** |
506 | * {@inheritdoc} |
507 | */ |
508 | public function isExecuted() { |
509 | return $this->mainFormState->isExecuted(); |
510 | } |
511 | |
512 | /** |
513 | * {@inheritdoc} |
514 | */ |
515 | public function setGroups(array $groups) { |
516 | // @todo What are groups? Is this the way to handle them in a sub-form? |
517 | $this->mainFormState->setGroups($groups); |
518 | return $this; |
519 | } |
520 | |
521 | /** |
522 | * {@inheritdoc} |
523 | */ |
524 | public function &getGroups() { |
525 | return $this->mainFormState->getGroups(); |
526 | } |
527 | |
528 | /** |
529 | * {@inheritdoc} |
530 | */ |
531 | public function setHasFileElement($has_file_element = TRUE) { |
532 | $this->mainFormState->setHasFileElement($has_file_element); |
533 | return $this; |
534 | } |
535 | |
536 | /** |
537 | * {@inheritdoc} |
538 | */ |
539 | public function hasFileElement() { |
540 | return $this->mainFormState->hasFileElement(); |
541 | } |
542 | |
543 | /** |
544 | * {@inheritdoc} |
545 | */ |
546 | public function setLimitValidationErrors($limit_validation_errors) { |
547 | $add_subkeys = function (array $path) { |
548 | return array_merge($this->subKeys, $path); |
549 | }; |
550 | $limit_validation_errors = array_map($add_subkeys, $limit_validation_errors); |
551 | $this->mainFormState->setLimitValidationErrors($limit_validation_errors); |
552 | return $this; |
553 | } |
554 | |
555 | /** |
556 | * {@inheritdoc} |
557 | */ |
558 | public function getLimitValidationErrors() { |
559 | $limit_validation_errors = $this->mainFormState->getLimitValidationErrors(); |
560 | if (is_null($limit_validation_errors)) { |
561 | return NULL; |
562 | } |
563 | $return = []; |
564 | $sub_keys_count = count($this->subKeys); |
565 | foreach ($limit_validation_errors as $path) { |
566 | if (array_slice($path, 0, $sub_keys_count) == $sub_keys_count) { |
567 | // If the whole sub-form is included, it is the same (for the sub-form) |
568 | // as if there was no limitation at all. |
569 | if (count($path) == $sub_keys_count) { |
570 | return NULL; |
571 | } |
572 | $return[] = $path; |
573 | } |
574 | } |
575 | return $return; |
576 | } |
577 | |
578 | /** |
579 | * {@inheritdoc} |
580 | */ |
581 | public function setMethod($method) { |
582 | $this->mainFormState->setMethod($method); |
583 | return $this; |
584 | } |
585 | |
586 | /** |
587 | * {@inheritdoc} |
588 | */ |
589 | public function setRequestMethod($method) { |
590 | $this->mainFormState->setRequestMethod($method); |
591 | return $this; |
592 | } |
593 | |
594 | /** |
595 | * {@inheritdoc} |
596 | */ |
597 | public function isMethodType($method_type): bool { |
598 | return $this->mainFormState->isMethodType($method_type); |
599 | } |
600 | |
601 | /** |
602 | * {@inheritdoc} |
603 | */ |
604 | public function setValidationEnforced($must_validate = TRUE) { |
605 | $this->mainFormState->setValidationEnforced($must_validate); |
606 | return $this; |
607 | } |
608 | |
609 | /** |
610 | * {@inheritdoc} |
611 | */ |
612 | public function isValidationEnforced(): bool { |
613 | return $this->mainFormState->isValidationEnforced(); |
614 | } |
615 | |
616 | /** |
617 | * {@inheritdoc} |
618 | */ |
619 | public function disableRedirect($no_redirect = TRUE) { |
620 | $this->mainFormState->disableRedirect($no_redirect); |
621 | return $this; |
622 | } |
623 | |
624 | /** |
625 | * {@inheritdoc} |
626 | */ |
627 | public function isRedirectDisabled(): bool { |
628 | return $this->mainFormState->isRedirectDisabled(); |
629 | } |
630 | |
631 | /** |
632 | * {@inheritdoc} |
633 | */ |
634 | public function setProcessInput($process_input = TRUE) { |
635 | $this->mainFormState->setProcessInput($process_input); |
636 | return $this; |
637 | } |
638 | |
639 | /** |
640 | * {@inheritdoc} |
641 | */ |
642 | public function isProcessingInput() { |
643 | return $this->mainFormState->isProcessingInput(); |
644 | } |
645 | |
646 | /** |
647 | * {@inheritdoc} |
648 | */ |
649 | public function setProgrammed($programmed = TRUE) { |
650 | $this->mainFormState->setProgrammed($programmed); |
651 | return $this; |
652 | } |
653 | |
654 | /** |
655 | * {@inheritdoc} |
656 | */ |
657 | public function isProgrammed() { |
658 | return $this->mainFormState->isProgrammed(); |
659 | } |
660 | |
661 | /** |
662 | * {@inheritdoc} |
663 | */ |
664 | public function setProgrammedBypassAccessCheck($programmed_bypass_access_check = TRUE) { |
665 | $this->mainFormState->setProgrammedBypassAccessCheck($programmed_bypass_access_check); |
666 | return $this; |
667 | } |
668 | |
669 | /** |
670 | * {@inheritdoc} |
671 | */ |
672 | public function isBypassingProgrammedAccessChecks() { |
673 | return $this->mainFormState->isBypassingProgrammedAccessChecks(); |
674 | } |
675 | |
676 | /** |
677 | * {@inheritdoc} |
678 | */ |
679 | public function setRebuildInfo(array $rebuild_info) { |
680 | $this->mainFormState->setRebuildInfo($rebuild_info); |
681 | return $this; |
682 | } |
683 | |
684 | /** |
685 | * {@inheritdoc} |
686 | */ |
687 | public function getRebuildInfo(): array { |
688 | return $this->mainFormState->getRebuildInfo(); |
689 | } |
690 | |
691 | /** |
692 | * {@inheritdoc} |
693 | */ |
694 | public function addRebuildInfo($property, $value) { |
695 | $this->mainFormState->addRebuildInfo($property, $value); |
696 | return $this; |
697 | } |
698 | |
699 | /** |
700 | * {@inheritdoc} |
701 | */ |
702 | public function setSubmitHandlers(array $submit_handlers) { |
703 | $this->mainFormState->setSubmitHandlers($submit_handlers); |
704 | return $this; |
705 | } |
706 | |
707 | /** |
708 | * {@inheritdoc} |
709 | */ |
710 | public function getSubmitHandlers(): array { |
711 | return $this->mainFormState->getSubmitHandlers(); |
712 | } |
713 | |
714 | /** |
715 | * {@inheritdoc} |
716 | */ |
717 | public function setSubmitted() { |
718 | $this->mainFormState->setSubmitted(); |
719 | return $this; |
720 | } |
721 | |
722 | /** |
723 | * {@inheritdoc} |
724 | */ |
725 | public function isSubmitted(): bool { |
726 | return $this->mainFormState->isSubmitted(); |
727 | } |
728 | |
729 | /** |
730 | * {@inheritdoc} |
731 | */ |
732 | public function setTemporary(array $temporary) { |
733 | $this->mainFormState->setTemporary($temporary); |
734 | return $this; |
735 | } |
736 | |
737 | /** |
738 | * {@inheritdoc} |
739 | */ |
740 | public function getTemporary(): array { |
741 | return $this->mainFormState->getTemporary(); |
742 | } |
743 | |
744 | /** |
745 | * {@inheritdoc} |
746 | */ |
747 | public function &getTemporaryValue($key) { |
748 | return $this->mainFormState->getTemporaryValue($key); |
749 | } |
750 | |
751 | /** |
752 | * {@inheritdoc} |
753 | */ |
754 | public function setTemporaryValue($key, $value) { |
755 | $this->mainFormState->setTemporaryValue($key, $value); |
756 | return $this; |
757 | } |
758 | |
759 | /** |
760 | * {@inheritdoc} |
761 | */ |
762 | public function hasTemporaryValue($key) { |
763 | return $this->mainFormState->getTemporaryValue($key); |
764 | } |
765 | |
766 | /** |
767 | * {@inheritdoc} |
768 | */ |
769 | public function setTriggeringElement($triggering_element) { |
770 | $this->mainFormState->setTriggeringElement($triggering_element); |
771 | return $this; |
772 | } |
773 | |
774 | /** |
775 | * {@inheritdoc} |
776 | */ |
777 | public function &getTriggeringElement() { |
778 | return $this->mainFormState->getTriggeringElement(); |
779 | } |
780 | |
781 | /** |
782 | * {@inheritdoc} |
783 | */ |
784 | public function setValidateHandlers(array $validate_handlers) { |
785 | $this->mainFormState->setValidateHandlers($validate_handlers); |
786 | return $this; |
787 | } |
788 | |
789 | /** |
790 | * {@inheritdoc} |
791 | */ |
792 | public function getValidateHandlers(): array { |
793 | return $this->mainFormState->getValidateHandlers(); |
794 | } |
795 | |
796 | /** |
797 | * {@inheritdoc} |
798 | */ |
799 | public function setValidationComplete($validation_complete = TRUE) { |
800 | $this->mainFormState->setValidationComplete($validation_complete); |
801 | return $this; |
802 | } |
803 | |
804 | /** |
805 | * {@inheritdoc} |
806 | */ |
807 | public function isValidationComplete(): bool { |
808 | return $this->mainFormState->isValidationComplete(); |
809 | } |
810 | |
811 | /** |
812 | * {@inheritdoc} |
813 | */ |
814 | public function getCleanValueKeys(): array { |
815 | return $this->mainFormState->getCleanValueKeys(); |
816 | } |
817 | |
818 | /** |
819 | * {@inheritdoc} |
820 | */ |
821 | public function setCleanValueKeys(array $keys) { |
822 | $this->mainFormState->setCleanValueKeys($keys); |
823 | return $this; |
824 | } |
825 | |
826 | /** |
827 | * {@inheritdoc} |
828 | */ |
829 | public function addCleanValueKey($key) { |
830 | $this->mainFormState->addCleanValueKey($key); |
831 | return $this; |
832 | } |
833 | |
834 | /** |
835 | * {@inheritdoc} |
836 | */ |
837 | public function cleanValues() { |
838 | $this->mainFormState->cleanValues(); |
839 | return $this; |
840 | } |
841 | |
842 | /** |
843 | * {@inheritdoc} |
844 | */ |
845 | public function setIgnoreDestination(bool $status = TRUE) { |
846 | $this->mainFormState->setIgnoreDestination($status); |
847 | return $this; |
848 | } |
849 | |
850 | /** |
851 | * {@inheritdoc} |
852 | */ |
853 | public function getIgnoreDestination(): bool { |
854 | return $this->mainFormState->getIgnoreDestination(); |
855 | } |
856 | |
857 | } |