Manual:Hooks/SpecialRandomGetRandomTitle
SpecialRandomGetRandomTitle | |
---|---|
Available from version 1.16.0 Modify the selection criteria for Special:Random | |
Define function: | public static function onSpecialRandomGetRandomTitle( &$randstr, &$isRedir, &$namespaces, &$extra, &$title ) { ... }
|
Attach hook: | In extension.json:
{
"Hooks": {
"SpecialRandomGetRandomTitle": "MediaWiki\\Extension\\MyExtension\\Hooks::onSpecialRandomGetRandomTitle"
}
}
|
Called from: | File(s): specials/SpecialRandompage.php |
Interface: | SpecialRandomGetRandomTitleHook.php |
For more information about attaching hooks, see Manual:Hooks .
For examples of extensions using this hook, see Category:SpecialRandomGetRandomTitle extensions.
Details
editAllows extensions to modify the selection criteria used in Special:Random and subclasses of it.
- &$randstr: A random number string, generated by wfRandom
- &$isRedir: Boolean, whether or not the page to be selected should be a redirect
- &$namespaces: An array of namespace indexes to get the page from
- &$extra: An array of extra SQL statements added to the WHERE clause of the query
- &$title: A Title object to redirect to if the hook returns false (must be set if the hook returns false)