|
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\Configuration\Form\Step\Step; |
|
15
|
|
|
|
|
16
|
|
|
use Romm\ConfigurationObject\Traits\ConfigurationObject\StoreArrayIndexTrait; |
|
17
|
|
|
use Romm\Formz\Configuration\AbstractFormzConfiguration; |
|
18
|
|
|
use Romm\Formz\Configuration\Form\Field\Field; |
|
19
|
|
|
|
|
20
|
|
|
class StepItem extends AbstractFormzConfiguration |
|
21
|
|
|
{ |
|
22
|
|
|
use StoreArrayIndexTrait; |
|
23
|
|
|
|
|
24
|
|
|
/** |
|
25
|
|
|
* @var int |
|
26
|
|
|
* @validate IntegerValidator |
|
27
|
|
|
* @validate Romm.Formz:PageExists |
|
28
|
|
|
*/ |
|
29
|
|
|
protected $pageUid; |
|
30
|
|
|
|
|
31
|
|
|
/** |
|
32
|
|
|
* @var string |
|
33
|
|
|
*/ |
|
34
|
|
|
protected $extension; |
|
35
|
|
|
|
|
36
|
|
|
/** |
|
37
|
|
|
* @var string |
|
38
|
|
|
*/ |
|
39
|
|
|
protected $controller; |
|
40
|
|
|
|
|
41
|
|
|
/** |
|
42
|
|
|
* @var string |
|
43
|
|
|
* @validate NotEmpty |
|
44
|
|
|
*/ |
|
45
|
|
|
protected $action; |
|
46
|
|
|
|
|
47
|
|
|
/** |
|
48
|
|
|
* @var \Romm\Formz\Configuration\Form\Step\Step\SupportedField[] |
|
49
|
|
|
*/ |
|
50
|
|
|
protected $supportedFields; |
|
51
|
|
|
|
|
52
|
|
|
/** |
|
53
|
|
|
* Name of the step. By default, it is the key of this step in the array |
|
54
|
|
|
* containing all the steps for the parent form. |
|
55
|
|
|
* |
|
56
|
|
|
* @var string |
|
57
|
|
|
*/ |
|
58
|
|
|
private $name; |
|
59
|
|
|
|
|
60
|
|
|
/** |
|
61
|
|
|
* @return int |
|
62
|
|
|
*/ |
|
63
|
|
|
public function getPageUid() |
|
64
|
|
|
{ |
|
65
|
|
|
return $this->pageUid; |
|
66
|
|
|
} |
|
67
|
|
|
|
|
68
|
|
|
/** |
|
69
|
|
|
* @return string |
|
70
|
|
|
*/ |
|
71
|
|
|
public function getExtension() |
|
72
|
|
|
{ |
|
73
|
|
|
return $this->extension; |
|
74
|
|
|
} |
|
75
|
|
|
|
|
76
|
|
|
/** |
|
77
|
|
|
* @return string |
|
78
|
|
|
*/ |
|
79
|
|
|
public function getController() |
|
80
|
|
|
{ |
|
81
|
|
|
return $this->controller; |
|
82
|
|
|
} |
|
83
|
|
|
|
|
84
|
|
|
/** |
|
85
|
|
|
* @return string |
|
86
|
|
|
*/ |
|
87
|
|
|
public function getAction() |
|
88
|
|
|
{ |
|
89
|
|
|
return $this->action; |
|
90
|
|
|
} |
|
91
|
|
|
|
|
92
|
|
|
/** |
|
93
|
|
|
* @return SupportedField[] |
|
94
|
|
|
*/ |
|
95
|
|
|
public function getSupportedFields() |
|
96
|
|
|
{ |
|
97
|
|
|
return $this->supportedFields; |
|
98
|
|
|
} |
|
99
|
|
|
|
|
100
|
|
|
/** |
|
101
|
|
|
* @param Field $field |
|
102
|
|
|
* @return bool |
|
103
|
|
|
*/ |
|
104
|
|
|
public function supportsField(Field $field) |
|
105
|
|
|
{ |
|
106
|
|
|
foreach ($this->supportedFields as $supportedField) { |
|
107
|
|
|
if ($supportedField->getField() === $field) { |
|
108
|
|
|
return true; |
|
109
|
|
|
} |
|
110
|
|
|
} |
|
111
|
|
|
|
|
112
|
|
|
return false; |
|
113
|
|
|
} |
|
114
|
|
|
|
|
115
|
|
|
/** |
|
116
|
|
|
* @return string |
|
117
|
|
|
*/ |
|
118
|
|
|
public function getName() |
|
119
|
|
|
{ |
|
120
|
|
|
if (null === $this->name) { |
|
121
|
|
|
$this->name = $this->getArrayIndex(); |
|
122
|
|
|
} |
|
123
|
|
|
|
|
124
|
|
|
return $this->name; |
|
125
|
|
|
} |
|
126
|
|
|
|
|
127
|
|
|
/** |
|
128
|
|
|
* @param string $name |
|
129
|
|
|
*/ |
|
130
|
|
|
public function setName($name) |
|
131
|
|
|
{ |
|
132
|
|
|
$this->name = $name; |
|
133
|
|
|
} |
|
134
|
|
|
} |
|
135
|
|
|
|