Manual:Hooks/HtmlPageLinkRendererEnd

From MediaWiki.org
Jump to navigation Jump to search
HtmlPageLinkRendererEnd
Available from version 1.28.0 (Gerrit change 284750)

Define function:
public static function onHtmlPageLinkRendererEnd( LinkRenderer $linkRenderer, LinkTarget $target, $isKnown, &$text, &$attribs, &$ret ) { ... }
Attach hook:

In extension.json:

{
	"Hooks": {
		"HtmlPageLinkRendererEnd": "MyExtensionHooks::onHtmlPageLinkRendererEnd"
	}
}

For MediaWiki ≤1.25:

$wgHooks['HtmlPageLinkRendererEnd'][] = 'MyExtensionHooks::onHtmlPageLinkRendererEnd';
Called from:File(s): includes/linker/LinkRenderer.php

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

Used when generating internal and interwiki links in LinkRenderer, just before the function returns a value. If you return true, an <a> element with HTML attributes $attribs and contents $html will be returned. If you return false, $ret will be returned.

Details[edit]

  • $linkRenderer: the LinkRenderer object
  • $target: the LinkTarget that the link is pointing to
  • $isKnown: boolean indicating whether the page is known or not
  • &$text: the contents that the <a> tag should have; either a plain, unescaped string or a HtmlArmor object.
  • &$attribs: the final HTML attributes of the <a> tag, after processing, in associative array form.
  • &$ret: the value to return if your hook returns false.

See also[edit]