Manual:Hooks/SpecialRandomGetRandomTitle
From Linux Web Expert
SpecialRandomGetRandomTitle | |
---|---|
<translate> Available from <tvar name=1><translate> version <tvar </tvar></translate> Modify the selection criteria for Special:Random | |
<translate> Define function:</translate> | public static function onSpecialRandomGetRandomTitle( &$randstr, &$isRedir, &$namespaces, &$extra, &$title ) { ... }
|
<translate> Attach hook:</translate> | <translate> In <tvar name=1>extension.json</tvar>:</translate>
{
"Hooks": {
"SpecialRandomGetRandomTitle": "MediaWiki\\Extension\\MyExtension\\Hooks::onSpecialRandomGetRandomTitle"
}
}
|
<translate> Called from:</translate> | <translate> File(s):</translate> specials/SpecialRandompage.php |
<translate> Interface:</translate> | SpecialRandomGetRandomTitleHook.php |
<translate> For more information about attaching hooks, see <tvar name=1>Manual:Hooks </tvar>.</translate>
<translate> For examples of extensions using this hook, see <tvar name=cat>Category:SpecialRandomGetRandomTitle extensions</tvar>.</translate>
Details
Allows 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)