Manual:Hooks/OutputPageRenderCategoryLink

Category:MediaWiki hooks#OutputPageRenderCategoryLink Category:Hooks added in MediaWiki 1.43.0#OutputPageRenderCategoryLink
OutputPageRenderCategoryLink
Available from version 1.43.0 (Gerrit change 1061107)
This hook is called when a category link is rendered.
Define function:
public static function onOutputPageRenderCategoryLink( MediaWiki\Output\OutputPage $outputPage, MediaWiki\Page\ProperPageIdentity $categoryTitle, string $text, ?string &$link ) { ... }
Attach hook: In extension.json:
{
	"Hooks": {
		"OutputPageRenderCategoryLink": "MediaWiki\\Extension\\MyExtension\\Hooks::onOutputPageRenderCategoryLink"
	}
}
Called from: File(s): Output/OutputPage.phpCategory:MediaWiki hooks included in OutputPage.php#OutputPageRenderCategoryLink, api/ApiParse.phpCategory:MediaWiki hooks included in ApiParse.php#OutputPageRenderCategoryLink
Interface: OutputPageRenderCategoryLinkHook.php

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

This hook was introduced so as to replace OutputPageMakeCategoryLinks. This is called when a category link is rendered.

Details

This hook must not abort, it must return no value.

  • MediaWiki\Output\OutputPage $outputPage
  • MediaWiki\Page\ProperPageIdentity $categoryTitle: Category title
  • string $text: HTML escaped category name
  • ?string &$link: HTML of rendered category link which can be replaced by a different HTML
Category:Hooks added in MediaWiki 1.43.0 Category:MediaWiki hooks Category:MediaWiki hooks included in ApiParse.php Category:MediaWiki hooks included in OutputPage.php