Manual:Hooks/SelfLinkBegin

From MediaWiki.org
Jump to navigation Jump to search
SelfLinkBegin
Available from version 1.24.0
called when rendering a self link on a page
Define function:
public static function onSelfLinkBegin( Title $nt, &$html, &$trail, &$prefix, &$ret ) { ... }
Attach hook:

In extension.json:

{
	"Hooks": {
		"SelfLinkBegin": "MyExtensionHooks::onSelfLinkBegin"
	}
}

For MediaWiki ≤1.25:

$wgHooks['SelfLinkBegin'][] = 'MyExtensionHooks::onSelfLinkBegin';
Called from:File(s): Linker.php

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

Details[edit]

  • Title $nt: the title object of the page
  • &$html: Link text
  • &$trail: Text after link
  • &$prefix: Text before link
  • &$ret: Self link text to be used if the hook returns false