Jump to content

Manual:Hooks/HtmlPageLinkRendererEnd

From mediawiki.org
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": "MediaWiki\\Extension\\MyExtension\\Hooks::onHtmlPageLinkRendererEnd"
	}
}
Called from: File(s): linker/LinkRenderer.php
Interface: HtmlPageLinkRendererEndHook.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, or without return value, an <a> element with HTML attributes $attribs and contents $text 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]