< Manual:Hooks
GetLocalURL | |
---|---|
Available from version 1.6.0 Used to modify local URLs as output into page links | |
Define function: | public static function onGetLocalURL( $title, $url, $query ) { ... }
|
Attach hook: | In extension.json:
{
"Hooks": {
"GetLocalURL": "MyExtensionHooks::onGetLocalURL"
}
}
|
Called from: | File(s): Title.php |
Interface: | GetLocalURLHook.php |
For more information about attaching hooks, see Manual:Hooks
For examples of extensions using this hook, see Category:GetLocalURL extensions.
Details
$title
: Title object of page$url
: string value as output (out parameter, can modify)$query
: query options passed toTitle::getLocalURL()
Usage
This hook can be used to alter the canonical URL of pages under specific circumstances. This is useful for instance since git #155d555b (MediaWiki 1.26) made MediaWiki automatically redirect from non-standard to canonical URLs. See an example usage at git #92dd60c4
This article is issued from Mediawiki. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.