Manual:Hooks/GetLinkColours
Appearance
| GetLinkColours | |
|---|---|
| Available from version 1.12.0 modify the CSS class of an array of page links | |
| Define function: | public static function onGetLinkColours( $linkcolour_ids, &$colours, $title ) { ... }
|
| Attach hook: | In extension.json:
{
"Hooks": {
"GetLinkColours": "MediaWiki\\Extension\\MyExtension\\Hooks::onGetLinkColours"
}
}
|
| Called from: | File(s): Parser/LinkHolderArray.php |
| Interface: | GetLinkColoursHook.php |
For more information about attaching hooks, see Manual:Hooks.
For examples of extensions using this hook, see Category:GetLinkColours extensions.
Details
[edit]- $linkcolour_ids: array of prefixed DB keys of the pages linked to, indexed by page_id.
- &$colours: (output) array of CSS classes, indexed by prefixed DB keys
- $title: Title of the page being parsed, on which the links will be shown (added in 1.35)
Notes
[edit]This hook is only called for links where the target page exists, not for links that already have a color (notably red). Since gerrit:1319571 this hook is only called for wikitext content but not for interface messages any more. Links in interface messages can still be red, but not modified by extensions like Extension:Disambiguator.