Jump to content

Manual:Hooks/TestCanonicalRedirect

From mediawiki.org
TestCanonicalRedirect
Available from version 1.18.0 (r97573, codereview)
Called when about to force a redirect to a canonical URL for a title when we have no other parameters on the URL.
Define function:
public static function onTestCanonicalRedirect( $request, $title, $output ) { ... }
Attach hook: In extension.json:
{
	"Hooks": {
		"TestCanonicalRedirect": "MediaWiki\\Extension\\MyExtension\\Hooks::onTestCanonicalRedirect"
	}
}
Called from: File(s): MediaWiki.php
Interface: TestCanonicalRedirectHook.php

For more information about attaching hooks, see Manual:Hooks .
For examples of extensions using this hook, see Category:TestCanonicalRedirect extensions.


Details

[edit]

Gives a chance for extensions that alter page view behavior radically to abort that redirect or handle it manually.

  • $request: WebRequest
  • $title: Title of the currently found title obj
  • $output: OutputPage object