Manual:Hooks/LinkBegin

Warning
In MediaWiki 1.28 it was superseded with .   is considered outdated.

Details
Return false to skip default processing and return $ret. See documentation for  for details on the expected meanings of parameters.


 * : used to be a skin, but that eliminated.
 * : the Title that the link is pointing to.
 * : the HTML attributes (such as title and class; href is ignored) that the  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.  Other attributes will replace default attributes.
 * : the query string to add to the generated URL (the bit after the "?"), in associative array form, with keys and values unescaped. Query keys and values will be URL-encoded.
 * : the options. Can include 'known', 'broken', 'noclasses', 'forcearticlepath', 'http', or 'https'.
 * : the value to return if your hook returns false.
 * : the value to return if your hook returns false.

$options values

 * : Page is known to exist, so don't check if it does.
 * : Page is known not to exist, so don't check if it does.
 * : Don't add any classes automatically (includes "new", "stub", "mw-redirect", "extiw"). Only use the class attribute provided, if any, so you get a simple blue link with no funny icons.
 * : Use the article path always, even with a querystring. Has compatibility issues on some setups, so avoid wherever possible.
 * : Force a full URL with http:// as the scheme.
 * : Force a full URL with https:// as the scheme.

Example
The following code will show all wikilinks as broken (i.e. as red links) by changing the  class to "new":

Another way to achieve the same result would be to change  instead of   and return , like this:

Note that neither of these examples will have any effect on interwiki links. For that, you'll need to use . See 1>Special:MyLanguage/Manual:Hooks/LinkEnd#Example|the example.