1
|
|
|
<?php |
2
|
|
|
/* |
3
|
|
|
* 2017 Romain CANON <[email protected]> |
4
|
|
|
* |
5
|
|
|
* This file is part of the TYPO3 FormZ project. |
6
|
|
|
* It is free software; you can redistribute it and/or modify it |
7
|
|
|
* under the terms of the GNU General Public License, either |
8
|
|
|
* version 3 of the License, or any later version. |
9
|
|
|
* |
10
|
|
|
* For the full copyright and license information, see: |
11
|
|
|
* http://www.gnu.org/licenses/gpl-3.0.html |
12
|
|
|
*/ |
13
|
|
|
|
14
|
|
|
namespace Romm\Formz\Form; |
15
|
|
|
|
16
|
|
|
use TYPO3\CMS\Core\Utility\GeneralUtility; |
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* This trait should be used by default to implement all the functions required |
20
|
|
|
* by the interface `FormInterface`. |
21
|
|
|
* |
22
|
|
|
* This is not advised to overrides the function provided by this trait, unless |
23
|
|
|
* you know what you are doing. |
24
|
|
|
*/ |
25
|
|
|
trait FormTrait |
26
|
|
|
{ |
27
|
|
|
/** |
28
|
|
|
* Contains the optional data returned from the validators of each field. |
29
|
|
|
* |
30
|
|
|
* @var array |
31
|
|
|
*/ |
32
|
|
|
protected $validationData = []; |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
* @deprecated This method is deprecated and will be deleted in FormZ v2. |
36
|
|
|
* |
37
|
|
|
* @param string $key |
38
|
|
|
* @return array |
39
|
|
|
*/ |
40
|
|
|
public function getValidationData($key = null) |
41
|
|
|
{ |
42
|
|
|
GeneralUtility::logDeprecatedFunction(); |
43
|
|
|
|
44
|
|
|
$result = $this->validationData; |
45
|
|
|
|
46
|
|
|
if (null !== $key) { |
47
|
|
|
$result = (isset($this->validationData[$key])) |
48
|
|
|
? $result = $this->validationData[$key] |
49
|
|
|
: null; |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
return $result; |
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* @deprecated This method is deprecated and will be deleted in FormZ v2. |
57
|
|
|
* |
58
|
|
|
* @param array $validationData |
59
|
|
|
* @internal |
60
|
|
|
*/ |
61
|
|
|
public function setValidationData(array $validationData) |
62
|
|
|
{ |
63
|
|
|
GeneralUtility::logDeprecatedFunction(); |
64
|
|
|
|
65
|
|
|
$this->validationData = $validationData; |
66
|
|
|
} |
67
|
|
|
} |
68
|
|
|
|