1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* WebHemi. |
4
|
|
|
* |
5
|
|
|
* PHP version 7.1 |
6
|
|
|
* |
7
|
|
|
* @copyright 2012 - 2018 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
|
|
|
* @codeCoverageIgnore - only composes an object. |
22
|
|
|
*/ |
23
|
|
|
class ApplicationCreateForm extends AbstractPreset |
24
|
|
|
{ |
25
|
|
|
/** |
26
|
|
|
* Initialize the adapter |
27
|
|
|
*/ |
28
|
|
|
protected function initAdapter() |
29
|
|
|
{ |
30
|
|
|
$this->formAdapter->initialize('application', '[URL]', 'POST'); |
31
|
|
|
} |
32
|
|
|
|
33
|
|
|
/** |
34
|
|
|
* Initialize and add elements to the form. |
35
|
|
|
* |
36
|
|
|
* @return void |
37
|
|
|
* |
38
|
|
|
* @codeCoverageIgnore - only composes an object. |
39
|
|
|
*/ |
40
|
|
|
protected function init() : void |
41
|
|
|
{ |
42
|
|
|
$this->initAdapter(); |
43
|
|
|
|
44
|
|
|
$name = $this->createElement( |
45
|
|
|
HtmlElement::class, |
46
|
|
|
HtmlElement::HTML_ELEMENT_INPUT_TEXT, |
47
|
|
|
'name', |
48
|
|
|
'Application name' |
49
|
|
|
); |
50
|
|
|
|
51
|
|
|
$title = $this->createElement( |
52
|
|
|
HtmlElement::class, |
53
|
|
|
HtmlElement::HTML_ELEMENT_INPUT_TEXT, |
54
|
|
|
'title', |
55
|
|
|
'Display name (title)' |
56
|
|
|
); |
57
|
|
|
|
58
|
|
|
$introduction = $this->createElement( |
59
|
|
|
HtmlElement::class, |
60
|
|
|
HtmlElement::HTML_ELEMENT_TEXTAREA, |
61
|
|
|
'introduction', |
62
|
|
|
'Introduction' |
63
|
|
|
); |
64
|
|
|
|
65
|
|
|
$subject = $this->createElement( |
66
|
|
|
HtmlElement::class, |
67
|
|
|
HtmlElement::HTML_ELEMENT_TEXTAREA, |
68
|
|
|
'subject', |
69
|
|
|
'Subject' |
70
|
|
|
); |
71
|
|
|
|
72
|
|
|
$description = $this->createElement( |
73
|
|
|
HtmlElement::class, |
74
|
|
|
HtmlElement::HTML_ELEMENT_TEXTAREA, |
75
|
|
|
'description', |
76
|
|
|
'Description' |
77
|
|
|
); |
78
|
|
|
|
79
|
|
|
$submit = $this->createElement( |
80
|
|
|
HtmlElement::class, |
81
|
|
|
HtmlElement::HTML_ELEMENT_SUBMIT, |
82
|
|
|
'submit', |
83
|
|
|
'Save' |
84
|
|
|
); |
85
|
|
|
|
86
|
|
|
$this->formAdapter->addElement($name) |
87
|
|
|
->addElement($title) |
88
|
|
|
->addElement($introduction) |
89
|
|
|
->addElement($subject) |
90
|
|
|
->addElement($description) |
91
|
|
|
->addElement($submit); |
92
|
|
|
} |
93
|
|
|
} |
94
|
|
|
|