Manual:Hooks/GetLinkColours

From Linux Web Expert

GetLinkColours
<translate> Available from <tvar name=1><translate> version <tvar </tvar></translate>
modify the CSS class of an array of page links
<translate> Define function:</translate>
public static function onGetLinkColours( $linkcolour_ids, &$colours, $title ) { ... }
<translate> Attach hook:</translate> <translate> In <tvar name=1>extension.json</tvar>:</translate>
{
	"Hooks": {
		"GetLinkColours": "MediaWiki\\Extension\\MyExtension\\Hooks::onGetLinkColours"
	}
}
<translate> Called from:</translate> <translate> File(s):</translate> LinkHolderArray.php
<translate> Interface:</translate> GetLinkColoursHook.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:GetLinkColours extensions</tvar>.</translate>

Details

  • $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

This hook is only called for each link where a target page exists.