Code Duplication    Length = 101-110 lines in 2 locations

src/HTMLForm/FormModelElementsHTML401.php 1 location

@@ 17-117 (lines=101) @@
14
     *
15
     * @param Anax\DI\DIInterface $di a service container
16
     */
17
    public function __construct(DIInterface $di)
18
    {
19
        parent::__construct($di);
20
        $this->form->create(
21
            [
22
                "id" => __CLASS__,
23
                "legend" => "Legend",
24
            ],
25
            [
26
                "text" => [
27
                    "type"        => "text",
28
                    "description" => "Here you can place a description.",
29
                    "placeholder" => "Here is a placeholder",
30
                ],
31
                        
32
                "password" => [
33
                    "type"        => "password",
34
                    "description" => "Here you can place a description.",
35
                    "placeholder" => "Here is a placeholder",
36
                ],
37
38
                "hidden" => [
39
                    "type"        => "hidden",
40
                    "value"       => "secret value",
41
                ],
42
43
                "file" => [
44
                    "type"        => "file",
45
                    "description" => "Here you can place a description.",
46
                ],
47
48
                "textarea" => [
49
                    "type"        => "textarea",
50
                    "description" => "Here you can place a description.",
51
                    "placeholder" => "Here is a placeholder",
52
                ],
53
54
                "radio" => [
55
                    "type"        => "radio",
56
                    "label"       => "What is your preferred choice of fruite?",
57
                    "description" => "Here you can place a description.",
58
                    "values"      => [
59
                        "tomato",
60
                        "potato",
61
                        "apple",
62
                        "pear",
63
                        "banana"
64
                    ],
65
                    "checked"     => "potato",
66
                ],
67
68
                "checkbox" => [
69
                    "type"        => "checkbox",
70
                    "description" => "Here you can place a description.",
71
                ],
72
73
                "select" => [
74
                    "type"        => "select",
75
                    "label"       => "Select your fruite:",
76
                    "description" => "Here you can place a description.",
77
                    "options"     => [
78
                        "tomato" => "tomato",
79
                        "potato" => "potato",
80
                        "apple"  => "apple",
81
                        "pear"   => "pear",
82
                        "banana" => "banana",
83
                    ],
84
                    "value"    => "potato",
85
                ],
86
87
                "selectm" => [
88
                    "type"        => "select-multiple",
89
                    "label"       => "Select one or more fruite:",
90
                    "description" => "Here you can place a description.",
91
                    "size"        => 6,
92
                    "options"     => [
93
                        "tomato" => "tomato",
94
                        "potato" => "potato",
95
                        "apple"  => "apple",
96
                        "pear"   => "pear",
97
                        "banana" => "banana",
98
                    ],
99
                    "checked"   => ["potato", "pear"],
100
                ],
101
102
                "reset" => [
103
                    "type"      => "reset",
104
                ],
105
106
                "button" => [
107
                    "type"      => "button",
108
                ],
109
110
                "submit" => [
111
                    "type" => "submit",
112
                    "value" => "Submit",
113
                    "callback" => [$this, "callbackSubmit"]
114
                ],
115
            ]
116
        );
117
    }
118
119
120

src/HTMLForm/FormModelStyle.php 1 location

@@ 17-126 (lines=110) @@
14
     *
15
     * @param Anax\DI\DIInterface $di a service container
16
     */
17
    public function __construct(DIInterface $di)
18
    {
19
        parent::__construct($di);
20
        $this->form->create(
21
            [
22
                "id" => __CLASS__,
23
                //"class" => "htmlform class1 class2",
24
                //"use_fieldset" => false,
25
                "legend" => "Legend",
26
                //"wrapper-element" => "div",
27
                //"br-after-label" => true,
28
            ],
29
            [
30
                "text" => [
31
                    "type"        => "text",
32
                    "description" => "Here you can place a description.",
33
                    "placeholder" => "Here is a placeholder",
34
                    //"wrapper-element" => "div",
35
                    //"wrapper-class"   => "wclass",
36
                    //"class"           => "specific",
37
                    //"br-after-label" => false,
38
                ],
39
                        
40
                "password" => [
41
                    "type"        => "password",
42
                    "description" => "Here you can place a description.",
43
                    "placeholder" => "Here is a placeholder",
44
                ],
45
46
                "hidden" => [
47
                    "type"        => "hidden",
48
                    "value"       => "secret value",
49
                ],
50
51
                "file" => [
52
                    "type"        => "file",
53
                    "description" => "Here you can place a description.",
54
                ],
55
56
                "textarea" => [
57
                    "type"        => "textarea",
58
                    "description" => "Here you can place a description.",
59
                    "placeholder" => "Here is a placeholder",
60
                ],
61
62
                "radio" => [
63
                    "type"        => "radio",
64
                    "label"       => "What is your preferred choice of fruite?",
65
                    "description" => "Here you can place a description.",
66
                    "values"      => [
67
                        "tomato",
68
                        "potato",
69
                        "apple",
70
                        "pear",
71
                        "banana"
72
                    ],
73
                    "checked"     => "potato",
74
                ],
75
76
                "checkbox" => [
77
                    "type"        => "checkbox",
78
                    "description" => "Here you can place a description.",
79
                ],
80
81
                "select" => [
82
                    "type"        => "select",
83
                    "label"       => "Select your fruite:",
84
                    "description" => "Here you can place a description.",
85
                    "options"     => [
86
                        "tomato" => "tomato",
87
                        "potato" => "potato",
88
                        "apple"  => "apple",
89
                        "pear"   => "pear",
90
                        "banana" => "banana",
91
                    ],
92
                    "value"    => "potato",
93
                ],
94
95
                "selectm" => [
96
                    "type"        => "select-multiple",
97
                    "label"       => "Select one or more fruite:",
98
                    "description" => "Here you can place a description.",
99
                    "size"        => 6,
100
                    "options"     => [
101
                        "tomato" => "tomato",
102
                        "potato" => "potato",
103
                        "apple"  => "apple",
104
                        "pear"   => "pear",
105
                        "banana" => "banana",
106
                    ],
107
                    "checked"   => ["potato", "pear"],
108
                ],
109
110
                "reset" => [
111
                    "type"      => "reset",
112
                ],
113
114
                "button" => [
115
                    "type"      => "button",
116
                    "onclick"   => "alert('hej');"
117
                ],
118
119
                "submit" => [
120
                    "type" => "submit",
121
                    "value" => "Submit",
122
                    "callback" => [$this, "callbackSubmit"]
123
                ],
124
            ]
125
        );
126
    }
127
128
129