Index: trunk/phase3/includes/Preferences.php |
— | — | @@ -1,27 +1,30 @@ |
2 | 2 | <?php |
3 | 3 | |
4 | 4 | /** |
5 | | - General information about this file: |
6 | | - We're now using the HTMLForm object with some customisation to generate the Preferences |
7 | | - form. This object handles generic submission, CSRF protection, layout and other logic |
8 | | - in a reusable manner. We subclass it as a PreferencesForm to make some minor |
9 | | - customisations. |
10 | | - In order to generate the form, the HTMLForm object needs an array structure detailing the |
11 | | - form fields available, and that's what this class is for. Each element of the array is |
12 | | - a basic property-list, including the type of field, the label it is to be given in the |
13 | | - form, callbacks for validation and 'filtering', and other pertinent information. Note that |
14 | | - the 'default' field is named for generic forms, and does not represent the preference's |
15 | | - default (which is stored in $wgDefaultUserOptions), but the default for the form field, |
16 | | - which should be whatever the user has set for that preference. There is no need to |
17 | | - override it unless you have some special storage logic (for instance, those not presently |
18 | | - stored as options, but which are best set from the user preferences view). |
19 | | - Field types are implemented as subclasses of the generic HTMLFormField object, and |
20 | | - typically implement at least getInputHTML, which generates the HTML for the input field |
21 | | - to be placed in the table. |
22 | | - Once fields have been retrieved and validated, submission logic is handed over to the |
23 | | - tryUISubmit static method of this class. |
24 | | - */ |
25 | | - |
| 5 | + * We're now using the HTMLForm object with some customisation to generate the |
| 6 | + * Preferences form. This object handles generic submission, CSRF protection, |
| 7 | + * layout and other logic in a reusable manner. We subclass it as a PreferencesForm |
| 8 | + * to make some minor customisations. |
| 9 | + * |
| 10 | + * In order to generate the form, the HTMLForm object needs an array structure |
| 11 | + * detailing the form fields available, and that's what this class is for. Each |
| 12 | + * element of the array is a basic property-list, including the type of field, |
| 13 | + * the label it is to be given in the form, callbacks for validation and |
| 14 | + * 'filtering', and other pertinent information. Note that the 'default' field |
| 15 | + * is named for generic forms, and does not represent the preference's default |
| 16 | + * (which is stored in $wgDefaultUserOptions), but the default for the form |
| 17 | + * field, which should be whatever the user has set for that preference. There |
| 18 | + * is no need to override it unless you have some special storage logic (for |
| 19 | + * instance, those not presently stored as options, but which are best set from |
| 20 | + * the user preferences view). |
| 21 | + * |
| 22 | + * Field types are implemented as subclasses of the generic HTMLFormField |
| 23 | + * object, and typically implement at least getInputHTML, which generates the |
| 24 | + * HTML for the input field to be placed in the table. |
| 25 | + * |
| 26 | + * Once fields have been retrieved and validated, submission logic is handed |
| 27 | + * over to the tryUISubmit static method of this class. |
| 28 | + */ |
26 | 29 | class Preferences { |
27 | 30 | static $defaultPreferences = null; |
28 | 31 | static $saveFilters = |