Manual:Hooks/InterwikiLoadPrefix
From Linux Web Expert
File:OOjs UI icon alert-destructive.svg | <translate>
This deprecated feature should no longer be used, but is still available for reasons of backwards compatibility. This feature was deprecated in version <tvar name=ver>1.36.0</tvar>.</translate> <translate> Please see <tvar name=page>$wgInterwikiCache</tvar> for an alternative way to use this feature.</translate> |
InterwikiLoadPrefix | |
---|---|
<translate> Available from <tvar name=1><translate> version <tvar (r84173, codereview)</tvar></translate> This hook is called when resolving whether a given prefix is an interwiki or not. | |
<translate> Define function:</translate> | public static function onInterwikiLoadPrefix( $prefix, &$interwikiData ) { ... }
|
<translate> Attach hook:</translate> | <translate> In <tvar name=1>extension.json</tvar>:</translate>
{
"Hooks": {
"InterwikiLoadPrefix": "MediaWiki\\Extension\\MyExtension\\Hooks::onInterwikiLoadPrefix"
}
}
|
<translate> Called from:</translate> | <translate> File(s):</translate> interwiki/Interwiki.php |
<translate> Interface:</translate> | InterwikiLoadPrefixHook.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:InterwikiLoadPrefix extensions</tvar>.</translate>
Parameters
Return true without providing an interwiki to continue interwiki search, or false to abort.
$prefix
: interwiki prefix we are looking for&$interwikiData
: output array describing the interwiki with keys interwiki.iw_url, interwiki.iw_local, interwiki.iw_trans and optionally interwiki.iw_api and interwiki.iw_wikiid.
This hook is not called when $wgInterwikiCache is used.
Notes
- This does not support enumerating all valid prefixes.