Manual:Hooks/HtmlPageLinkRendererBegin
From Linux Web Expert
HtmlPageLinkRendererBegin | |
---|---|
<translate> Available from <tvar name=1><translate> version <tvar (Gerrit change 284750)</tvar></translate> | |
<translate> Define function:</translate> | public static function onHtmlPageLinkRendererBegin( LinkRenderer $linkRenderer, LinkTarget $target, &$text, &$extraAttribs, &$query, &$ret ) { ... }
|
<translate> Attach hook:</translate> | <translate> In <tvar name=1>extension.json</tvar>:</translate>
{
"Hooks": {
"HtmlPageLinkRendererBegin": "MediaWiki\\Extension\\MyExtension\\Hooks::onHtmlPageLinkRendererBegin"
}
}
|
<translate> Called from:</translate> | <translate> File(s):</translate> linker/LinkRenderer.php <translate> Function(s):</translate> LinkRenderer::runBeginHook() |
<translate> Interface:</translate> | HtmlPageLinkRendererBeginHook.php |
<translate> For more information about attaching hooks, see <tvar name=1>Manual:Hooks </tvar>.</translate>
<translate> For examples of extensions using this hook, see <tvar name=cat>Category:HtmlPageLinkRendererBegin extensions</tvar>.</translate>
Used when generating internal and interwiki links in LinkRenderer, before processing starts. Return false to skip default processing and return $ret.
Details
$linkRenderer
: the LinkRenderer object$target
: the LinkTarget that the link is pointing to&$text
: the contents that the <a> tag should have; either a plain, unescaped string or a HtmlArmor object; null means "default".&$customAttribs
: the HTML attributes that the <a> tag should have, in associative array form, with keys and values unescaped. Should be merged with default values, with a value of false meaning to suppress the attribute.&$query
: the query string to add to the generated URL (the bit after the "?"), in associative array form, with keys and values unescaped.&$ret
: the value to return if your hook returns false.