1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* Copyright (C) 2015 Michael Herold <[email protected]> |
5
|
|
|
* |
6
|
|
|
* This program is free software: you can redistribute it and/or modify |
7
|
|
|
* it under the terms of the GNU General Public License as published by |
8
|
|
|
* the Free Software Foundation, either version 3 of the License, or |
9
|
|
|
* (at your option) any later version. |
10
|
|
|
* |
11
|
|
|
* This program is distributed in the hope that it will be useful, |
12
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
13
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14
|
|
|
* GNU General Public License for more details. |
15
|
|
|
* |
16
|
|
|
* You should have received a copy of the GNU General Public License |
17
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
18
|
|
|
*/ |
19
|
|
|
|
20
|
|
|
namespace hemio\form\Abstract_; |
21
|
|
|
|
22
|
|
|
use hemio\html\Interface_\Submittable; |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* |
26
|
|
|
* |
27
|
|
|
* @author Michael Herold <[email protected]> |
28
|
|
|
*/ |
29
|
|
|
abstract class TemplateFormField extends Template { |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* |
33
|
|
|
* @var string |
34
|
|
|
*/ |
35
|
|
|
public $title; |
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* |
39
|
|
|
* @var \hemio\html\Interface_\Submittable |
40
|
|
|
*/ |
41
|
|
|
protected $control; |
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* |
45
|
|
|
* @var Abstract_\FormField |
46
|
|
|
*/ |
47
|
|
|
public $field; |
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* |
51
|
|
|
* @var callable |
52
|
|
|
*/ |
53
|
|
|
protected $postInitHook; |
54
|
|
|
|
55
|
|
|
abstract public function init(FormField $field, Submittable $control); |
56
|
|
|
|
57
|
|
|
/** |
58
|
|
|
* |
59
|
|
|
* @return \hemio\html\Interface_\Submittable |
60
|
|
|
*/ |
61
|
|
|
public function getControl() { |
62
|
|
|
return $this->control; |
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
/** |
66
|
|
|
* |
67
|
|
|
* @param \hemio\html\Interface_\Submittable $control |
68
|
|
|
* @return \hemio\html\Interface_\Submittable |
69
|
|
|
*/ |
70
|
|
|
public function setControl(\hemio\html\Interface_\Submittable $control) { |
71
|
|
|
$this->control = $control; |
72
|
|
|
return $control; |
73
|
|
|
} |
74
|
|
|
|
75
|
|
|
/** |
76
|
|
|
* |
77
|
|
|
* @param \hemio\form\Abstract_\FormField $field |
78
|
|
|
* @return \hemio\form\Abstract_\FormField |
79
|
|
|
*/ |
80
|
|
|
public function setField(FormField $field) { |
81
|
|
|
$this->field = $field; |
|
|
|
|
82
|
|
|
return $field; |
83
|
|
|
} |
84
|
|
|
|
85
|
|
|
/** |
86
|
|
|
* |
87
|
|
|
* @param \hemio\form\Abstract_\callable $function |
88
|
|
|
*/ |
89
|
|
|
public function setPostInitHook(callable $function) { |
90
|
|
|
$this->postInitHook = $function; |
91
|
|
|
} |
92
|
|
|
|
93
|
|
|
} |
94
|
|
|
|
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..