< Manual:Hooks
| PreferencesFormPreSave | |
|---|---|
| Available from version 1.23.0 (Gerrit change 100113) Allows last minute changes to a user's preferences (via User#setOption) before they're saved and gives a possibility to check which options were modified. | |
| Define function: | public static function onPreferencesFormPreSave( array $formData, PreferencesForm $form, User $user, bool &$result, array $oldUserOptions ) { ... }
|
| Attach hook: | In extension.json:
{
"Hooks": {
"PreferencesFormPreSave": "MyExtensionHooks::onPreferencesFormPreSave"
}
}
|
| Called from: | File(s): preferences/DefaultPreferencesFactory.php |
| Interface: | PreferencesFormPreSaveHook.php |
For more information about attaching hooks, see Manual:Hooks.
For examples of extensions using this hook, see Category:PreferencesFormPreSave extensions.
Details
- $formData - An associative array containing the data from the preferences form.
- $form - The
PreferencesFormobject that represents the preferences form. - $user - The
Userobject that can be used to change the user's preferences. - &$result - The boolean return value of the
Preferences::tryFormSubmitmethod. - $oldUserOptions - An associative array containing the old user options (before save).
This article is issued from Mediawiki. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.