< Manual:Hooks
![]() | This feature was removed from MediaWiki core in version 1.17.0. Please see GetPreferences for an alternative way to use this feature. |
UserToggles | |
---|---|
Available from version 1.8.0 Removed in version 1.17.0 Provides an opportunity to dynamically add user toggles | |
Define function: | public static function onUserToggles( &$extraToggles ) { ... }
|
Attach hook: | In extension.json:
{
"Hooks": {
"UserToggles": "MyExtensionHooks::onUserToggles"
}
}
|
Called from: | File(s): User.php |
Interface: | UserTogglesHook.php |
For more information about attaching hooks, see Manual:Hooks
For examples of extensions using this hook, see Category:UserToggles extensions.
Background
The MediaWiki special page Special:Preferences contains a number of checkboxes. The values for these check boxes come from two sources:
- a list of hard coded toggles defined in User.php
- toggles added dynamically via the
UserToggles
hook.
Details
Implementers add their dynamically generated toggles by adding elements to $extraToggles
. The array consists of a list of system messages, each of which identifies the user toggle and its accompanying localized check box message.
See also
This article is issued from Mediawiki. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.