Manual:Hooks/BeforePageRedirect
From Linux Web Expert
BeforePageRedirect | |
---|---|
<translate> Available from <tvar name=1><translate> version <tvar </tvar></translate> Called prior to sending an HTTP redirect | |
<translate> Define function:</translate> | public static function onBeforePageRedirect( $out, &$redirect, &$code ) { ... }
|
<translate> Attach hook:</translate> | <translate> In <tvar name=1>extension.json</tvar>:</translate>
{
"Hooks": {
"BeforePageRedirect": "MediaWiki\\Extension\\MyExtension\\Hooks::onBeforePageRedirect"
}
}
|
<translate> Called from:</translate> | <translate> File(s):</translate> OutputPage.php |
<translate> Interface:</translate> | BeforePageRedirectHook.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:BeforePageRedirect extensions</tvar>.</translate>
Gives a chance to override how the redirect is output by modifying, or by returning false and taking over the output.
$out
: OutputPage object&$redirect
: URL string, modifiable&$code
: HTTP code (eg '301' or '302'), modifiable