Jump to content

Manual:Hooks/GetCanonicalURL

From mediawiki.org
GetCanonicalURL
Available from version 1.18.0 (r94995, codereview)
Allows to modify fully-qualified URLs used for IRC and e-mail notifications.
Define function:
public static function onGetCanonicalURL( $title, &$url, $query ) { ... }
Attach hook: In extension.json:
{
	"Hooks": {
		"GetCanonicalURL": "MediaWiki\\Extension\\MyExtension\\Hooks::onGetCanonicalURL"
	}
}
Called from: File(s): Title.php
Interface: GetCanonicalURLHook.php

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


Details

[edit]
  • $title: Title object of page
  • $url: string value as output (out parameter, can modify)
  • $query: query options passed to Title::getCanonicalURL()