1 | <?php |
||
21 | class FormHelper |
||
22 | { |
||
23 | /** |
||
24 | * Array with paths where entities(field, rule, form) can be found. |
||
25 | * |
||
26 | * Array's structure: |
||
27 | * <code> |
||
28 | * paths: |
||
29 | * {ENTITY_NAME}: |
||
30 | * - /path/1 |
||
31 | * - /path/2 |
||
32 | * </code> |
||
33 | * |
||
34 | * @var array |
||
35 | * @since 1.0 |
||
36 | * |
||
37 | */ |
||
38 | protected static $paths; |
||
39 | |||
40 | /** |
||
41 | * Static array of Joomla\Form's entity objects for re-use. |
||
42 | * Prototypes for all fields and rules are here. |
||
43 | * |
||
44 | * Array's structure: |
||
45 | * <code> |
||
46 | * entities: |
||
47 | * {ENTITY_NAME}: |
||
48 | * {KEY}: {OBJECT} |
||
49 | * </code> |
||
50 | * |
||
51 | * @var array |
||
52 | * @since 1.0 |
||
53 | * @deprecated 2.0 Objects should be autoloaded |
||
54 | */ |
||
55 | protected static $entities = array(); |
||
56 | |||
57 | /** |
||
58 | * Method to load a form field object given a type. |
||
59 | * |
||
60 | * @param string $type The field type. |
||
61 | * @param boolean $new Flag to toggle whether we should get a new instance of the object. |
||
62 | * |
||
63 | * @return mixed Field object on success, false otherwise. |
||
64 | * |
||
65 | * @since 1.0 |
||
66 | * @deprecated 2.0 Field objects should be autoloaded |
||
67 | */ |
||
68 | public static function loadFieldType($type, $new = true) |
||
72 | |||
73 | /** |
||
74 | * Method to load a form rule object given a type. |
||
75 | * |
||
76 | * @param string $type The rule type. |
||
77 | * @param boolean $new Flag to toggle whether we should get a new instance of the object. |
||
78 | * |
||
79 | * @return mixed Rule object on success, false otherwise. |
||
80 | * |
||
81 | * @since 1.0 |
||
82 | * @deprecated 2.0 Rule objects should be autoloaded |
||
83 | */ |
||
84 | public static function loadRuleType($type, $new = true) |
||
88 | |||
89 | /** |
||
90 | * Method to load a form entity object given a type. |
||
91 | * Each type is loaded only once and then used as a prototype for other objects of same type. |
||
92 | * Please, use this method only with those entities which support types (forms don't support them). |
||
93 | * |
||
94 | * @param string $entity The entity. |
||
95 | * @param string $type The entity type. |
||
96 | * @param boolean $new Flag to toggle whether we should get a new instance of the object. |
||
97 | * |
||
98 | * @return mixed Entity object on success, false otherwise. |
||
99 | * |
||
100 | * @since 1.0 |
||
101 | * @deprecated 2.0 Objects should be autoloaded |
||
102 | */ |
||
103 | protected static function loadType($entity, $type, $new = true) |
||
130 | |||
131 | /** |
||
132 | * Attempt to import the Field class file if it isn't already imported. |
||
133 | * You can use this method outside of Joomla\Form for loading a field for inheritance or composition. |
||
134 | * |
||
135 | * @param string $type Type of a field whose class should be loaded. |
||
136 | * |
||
137 | * @return mixed Class name on success or false otherwise. |
||
138 | * |
||
139 | * @since 1.0 |
||
140 | */ |
||
141 | public static function loadFieldClass($type) |
||
145 | |||
146 | /** |
||
147 | * Attempt to import the Rule class file if it isn't already imported. |
||
148 | * You can use this method outside of Joomla\Form for loading a rule for inheritance or composition. |
||
149 | * |
||
150 | * @param string $type Type of a rule whose class should be loaded. |
||
151 | * |
||
152 | * @return mixed Class name on success or false otherwise. |
||
153 | * |
||
154 | * @since 1.0 |
||
155 | */ |
||
156 | public static function loadRuleClass($type) |
||
160 | |||
161 | /** |
||
162 | * Load a class for one of the form's entities of a particular type. |
||
163 | * Currently, it makes sense to use this method for the "field" and "rule" entities |
||
164 | * (but you can support more entities in your subclass). |
||
165 | * |
||
166 | * @param string $entity One of the form entities (field or rule). |
||
167 | * @param string $type Type of an entity. |
||
168 | * |
||
169 | * @return mixed Class name on success or false otherwise. |
||
170 | * |
||
171 | * @since 1.0 |
||
172 | */ |
||
173 | protected static function loadClass($entity, $type) |
||
246 | |||
247 | /** |
||
248 | * Method to add a path to the list of field include paths. |
||
249 | * |
||
250 | * @param mixed $new A path or array of paths to add. |
||
251 | * |
||
252 | * @return array The list of paths that have been added. |
||
253 | * |
||
254 | * @since 1.0 |
||
255 | * @deprecated 2.0 Field objects should be autoloaded |
||
256 | */ |
||
257 | public static function addFieldPath($new = null) |
||
261 | |||
262 | /** |
||
263 | * Method to add a path to the list of form include paths. |
||
264 | * |
||
265 | * @param mixed $new A path or array of paths to add. |
||
266 | * |
||
267 | * @return array The list of paths that have been added. |
||
268 | * |
||
269 | * @since 1.0 |
||
270 | */ |
||
271 | public static function addFormPath($new = null) |
||
275 | |||
276 | /** |
||
277 | * Method to add a path to the list of rule include paths. |
||
278 | * |
||
279 | * @param mixed $new A path or array of paths to add. |
||
280 | * |
||
281 | * @return array The list of paths that have been added. |
||
282 | * |
||
283 | * @since 1.0 |
||
284 | * @deprecated 2.0 Rule objects should be autoloaded |
||
285 | */ |
||
286 | public static function addRulePath($new = null) |
||
290 | |||
291 | /** |
||
292 | * Method to add a path to the list of include paths for one of the form's entities. |
||
293 | * Currently supported entities: field, rule and form. You are free to support your own in a subclass. |
||
294 | * |
||
295 | * @param string $entity Form's entity name for which paths will be added. |
||
296 | * @param mixed $new A path or array of paths to add. |
||
297 | * |
||
298 | * @return array The list of paths that have been added. |
||
299 | * |
||
300 | * @since 1.0 |
||
301 | */ |
||
302 | protected static function addPath($entity, $new = null) |
||
341 | } |
||
342 |
This method has been deprecated. The supplier of the class has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.