Debian Codegraph @

includes/user/Options/Hook/SaveUserOptionsHook.php

raw symbols SCIP
1 <?php
2
3 namespace MediaWiki\User\Options\Hook;
4
5 use MediaWiki\User\UserIdentity;
6
7 /**
8 * This is a hook handler interface, see docs/Hooks.md.
9 * Use the hook name "SaveUserOptions" to register handlers implementing this interface.
10 *
11 * @stable to implement
12 * @ingroup Hooks
13 */
14 interface SaveUserOptionsHook {
15 /**
16 * This hook is called just before saving user preferences.
17 *
18 * Hook handlers can either add or manipulate options, or reset one back to its default
19 * to block changing it. Hook handlers are also allowed to abort the process by returning
20 * false, e.g. to save to a global profile instead. Compare to the UserSaveSettings
21 * hook, which is called after the preferences have been saved.
22 *
23 * @since 1.37
24 *
25 * @param UserIdentity $user The user for which the options are going to be saved
26 * @param array &$modifiedOptions The user's options as an associative array, modifiable.
27 * To reset the preference value to default, set the preference to null.
28 * To block the preference from changing, unset the key from the array.
29 * To modify a preference value, set a new value.
30 * @param array $originalOptions The user's original options being replaced
31 * @return bool|void True or no return value to continue or false to abort
32 */
33 public function onSaveUserOptions( UserIdentity $user, array &$modifiedOptions, array $originalOptions );
34 }