1 | <?php namespace Rocket\UI\Forms; |
||
26 | class Forms |
||
27 | { |
||
28 | /** |
||
29 | * Hold the configuration array |
||
30 | * |
||
31 | * @var array |
||
32 | */ |
||
33 | public static $config; |
||
34 | |||
35 | public static $currentValidator; |
||
36 | public static $currentData; |
||
37 | |||
38 | public static $adapters = [ |
||
39 | \Rocket\UI\Forms\ValidatorAdapters\LaravelValidator::class, |
||
40 | \Rocket\UI\Forms\ValidatorAdapters\CodeIgniterFormValidator::class, |
||
41 | ]; |
||
42 | |||
43 | /** |
||
44 | * Set the current configuration |
||
45 | * |
||
46 | * @param $config |
||
47 | */ |
||
48 | public static function setConfig($config) |
||
52 | |||
53 | /** |
||
54 | * @param object $validator |
||
55 | * @param mixed $data |
||
56 | * @param mixed $defaults |
||
57 | * @return bool |
||
58 | */ |
||
59 | public static function setFormValidator($validator, $data = [], $defaults = []) |
||
71 | |||
72 | /** |
||
73 | * @return ValidatorInterface |
||
74 | */ |
||
75 | public static function getFormValidator() |
||
83 | |||
84 | /** |
||
85 | * @param string $adapter |
||
86 | */ |
||
87 | public static function addFormValidatorAdapter($adapter) |
||
95 | |||
96 | /** |
||
97 | * Get the list of field types |
||
98 | * |
||
99 | * @return mixed |
||
100 | */ |
||
101 | public static function getFieldTypes() |
||
105 | |||
106 | /** |
||
107 | * Shortcut to create a field |
||
108 | * |
||
109 | * @param $type |
||
110 | * @param $arguments |
||
111 | * @return Fields\Field |
||
112 | */ |
||
113 | public static function __callStatic($type, $arguments) |
||
123 | |||
124 | /** |
||
125 | * Create a field |
||
126 | * |
||
127 | * @param string $id |
||
128 | * @param string $title |
||
129 | * @param string $type |
||
130 | * @return \Rocket\UI\Forms\Fields\Field |
||
131 | */ |
||
132 | public static function field($id, $title = '', $type = 'text') |
||
145 | |||
146 | public static function getValue($field, $default = '') |
||
154 | |||
155 | public static function open(array $options = []) |
||
164 | |||
165 | public static function close() |
||
171 | |||
172 | public static function submit($value = null, $options = []) |
||
176 | } |
||
177 |