Manual:Hooks/LinkBegin

From MediaWiki.org
Jump to: navigation, search
LinkBegin
Available from version 1.14.0
Used when generating internal and interwiki links in Linker::link(), before processing starts.

Define function:
public static function onLinkBegin( $skin, $target, &$text, &$customAttribs, &$query, &$options, &$ret ) { ... }

Attach hook:
$wgHooks['LinkBegin'][] = 'MyExtensionHooks::onLinkBegin';
Called from: Linker.php

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


Details [edit]

Return false to skip default processing and return $ret. See documentation for Linker::link() for details on the expected meanings of parameters.

  • $skin: the Skin object
  • $target: the Title that the link is pointing to
  • &$text: the contents that the <a> tag should have (raw HTML); 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.
  • &$options: the options. Can include 'known', 'broken', 'noclasses'.
  • &$ret: the value to return if your hook returns false.


Language: English  • 日本語