PluginProbe
User Access Manager / 2.3.0
User Access Manager v2.3.0
2.3.20 2.3.19 2.3.18 2.3.17 2.3.16 2.3.15 2.3.14 2.3.13 trunk 0.6 0.6.1 0.6.2 0.7 0.7 Beta 0.7.0.1 0.8 0.8.0.1 0.8.0.2 0.9 0.9.1 0.9.1.1 0.9.1.2 0.9.1.3 0.9.1.4 1.0 All 136 releases
user-access-manager / src / Form / FormFactory.php

FormFactory.php in User Access Manager 2.3.0, at src/Form/FormFactory.php

67 lines 1.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 declare(strict_types=1);
4
5 namespace UserAccessManager\Form;
6
7 use Exception;
8
9 class FormFactory
10 {
11 public function createFrom(): Form
12 {
13 return new Form();
14 }
15
16 public function createValueSetFromElementValue(mixed $value, string $label): ValueSetFormElementValue
17 {
18 return new ValueSetFormElementValue($value, $label);
19 }
20
21 public function createMultipleFormElementValue(mixed $value, string $label): MultipleFormElementValue
22 {
23 return new MultipleFormElementValue($value, $label);
24 }
25
26 public function createInput(
27 string $id,
28 mixed $value = null,
29 ?string $label = null,
30 ?string $description = null
31 ): Input {
32 return new Input($id, $value, $label, $description);
33 }
34
35 public function createTextarea(
36 string $id,
37 mixed $value = null,
38 ?string $label = null,
39 ?string $description = null
40 ): Textarea {
41 return new Textarea($id, $value, $label, $description);
42 }
43
44 public function createSelect(
45 string $id,
46 array $possibleValues,
47 mixed $value = null,
48 ?string $label = null,
49 ?string $description = null
50 ): Select {
51 return new Select($id, $possibleValues, $value, $label, $description);
52 }
53
54 /**
55 * @throws Exception
56 */
57 public function createRadio(
58 string $id,
59 array $possibleValues,
60 mixed $value = null,
61 ?string $label = null,
62 ?string $description = null
63 ): Radio {
64 return new Radio($id, $possibleValues, $value, $label, $description);
65 }
66 }
67