1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* WebHemi. |
4
|
|
|
* |
5
|
|
|
* PHP version 7.1 |
6
|
|
|
* |
7
|
|
|
* @copyright 2012 - 2017 Gixx-web (http://www.gixx-web.com) |
8
|
|
|
* @license https://opensource.org/licenses/MIT The MIT License (MIT) |
9
|
|
|
* |
10
|
|
|
* @link http://www.gixx-web.com |
11
|
|
|
*/ |
12
|
|
|
declare(strict_types = 1); |
13
|
|
|
|
14
|
|
|
namespace WebHemi\Form\Preset; |
15
|
|
|
|
16
|
|
|
use WebHemi\Form\Element\Html\HtmlElement; |
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* Class ApplicationEditForm |
20
|
|
|
*/ |
21
|
|
|
class ApplicationEditForm extends AbstractPreset |
22
|
|
|
{ |
23
|
|
|
/** |
24
|
|
|
* Initialize the adapter |
25
|
|
|
*/ |
26
|
|
|
protected function initAdapter() |
27
|
|
|
{ |
28
|
|
|
$this->formAdapter->initialize('application', '[URL]/save', 'POST'); |
29
|
|
|
} |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* Initialize and add elements to the form. |
33
|
|
|
* |
34
|
|
|
* @return void |
35
|
|
|
* |
36
|
|
|
* @codeCoverageIgnore - only composes an object. |
37
|
|
|
*/ |
38
|
|
|
protected function init() : void |
39
|
|
|
{ |
40
|
|
|
$this->initAdapter(); |
41
|
|
|
|
42
|
|
|
$name = $this->createElement( |
43
|
|
|
HtmlElement::class, |
44
|
|
|
HtmlElement::HTML_ELEMENT_INPUT_TEXT, |
45
|
|
|
'name', |
46
|
|
|
'Application name' |
47
|
|
|
); |
48
|
|
|
|
49
|
|
|
$title = $this->createElement( |
50
|
|
|
HtmlElement::class, |
51
|
|
|
HtmlElement::HTML_ELEMENT_INPUT_TEXT, |
52
|
|
|
'title', |
53
|
|
|
'Display name (title)' |
54
|
|
|
); |
55
|
|
|
|
56
|
|
|
$description = $this->createElement( |
57
|
|
|
HtmlElement::class, |
58
|
|
|
HtmlElement::HTML_ELEMENT_TEXTAREA, |
59
|
|
|
'description', |
60
|
|
|
'Description' |
61
|
|
|
); |
62
|
|
|
|
63
|
|
|
$enabled = $this->createElement( |
64
|
|
|
HtmlElement::class, |
65
|
|
|
HtmlElement::HTML_ELEMENT_INPUT_CHECKBOX, |
66
|
|
|
'is_enabled', |
67
|
|
|
'Activated ?' |
68
|
|
|
); |
69
|
|
|
|
70
|
|
|
$submit = $this->createElement( |
71
|
|
|
HtmlElement::class, |
72
|
|
|
HtmlElement::HTML_ELEMENT_SUBMIT, |
73
|
|
|
'submit', |
74
|
|
|
'Save' |
75
|
|
|
); |
76
|
|
|
|
77
|
|
|
$this->formAdapter->addElement($name) |
78
|
|
|
->addElement($title) |
79
|
|
|
->addElement($description) |
80
|
|
|
->addElement($enabled) |
81
|
|
|
->addElement($submit); |
82
|
|
|
} |
83
|
|
|
} |
84
|
|
|
|