1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* Copyright (C) 2015-2016 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\template; |
21
|
|
|
|
22
|
|
|
use hemio\form\Abstract_; |
23
|
|
|
use hemio\html\Interface_\Submittable; |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* Just the control element without any label etc. |
27
|
|
|
* |
28
|
|
|
* @author Michael Herold <[email protected]> |
29
|
|
|
*/ |
30
|
|
|
class FormPlainControl extends \hemio\form\Abstract_\TemplateFormField { |
31
|
|
|
|
32
|
|
|
public function __construct() { |
33
|
|
|
$this->setPostInitHook(function ($null) { |
|
|
|
|
34
|
|
|
return; |
35
|
|
|
}); |
36
|
|
|
} |
37
|
|
|
|
38
|
|
|
public function init(Abstract_\FormField $field, Submittable $control) { |
39
|
|
|
$this->setControl($control); |
40
|
|
|
$this->setField($field); |
41
|
|
|
|
42
|
|
|
if (!$control->getAttribute('title')) |
43
|
|
|
$control->setAttribute('title', $field->title); |
|
|
|
|
44
|
|
|
|
45
|
|
|
$control->setAttribute('name', $field->getHtmlName()); |
46
|
|
|
$control->setId($field->getHtmlId()); |
47
|
|
|
|
48
|
|
|
$this->addChild($control); |
|
|
|
|
49
|
|
|
|
50
|
|
|
$hook = $this->postInitHook; |
51
|
|
|
$hook($this); |
52
|
|
|
} |
53
|
|
|
|
54
|
|
|
} |
55
|
|
|
|
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.