Manual:Hooks/ParserLimitReportFormat

From mediawiki.org
ParserLimitReportFormat
Available from version 1.22.0 (Gerrit change 53802)
Called for each row in the parser limit report that needs formatting.
Define function:
public static function onParserLimitReportFormat( $key, &$value, &$report, $isHTML, $localize ) { ... }
Attach hook: In extension.json:
{
	"Hooks": {
		"ParserLimitReportFormat": "MediaWiki\\Extension\\MyExtension\\Hooks::onParserLimitReportFormat"
	}
}
Called from: File(s): parser/Parser.php
Function(s): makeLimitReport
Interface: ParserLimitReportFormatHook.php

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


Return false from the hook and append to $report for custom formatting.

The default formatting is to use {$key} to get the label, and {$key}-value-text/ {$key}-value-html (depending on the value of $isHTML) or if that doesn't exist, {$key}-value, to format the value. If that doesn't exist either, the value will be displayed raw. If either the key message or the value message is disabled, this item will be skipped in the report.

Note that these messages cannot be customized via MediaWiki: pages.

Details[edit]

  • $key: Key for the limit report item (string)
  • &$value: Value of the limit report item
  • &$report: String onto which to append the data
  • $isHTML: If true, $report is an HTML table with two columns; if false, it's text intended for display in a monospaced font. Plain mode is used for placing the report inside the page as a HTML comment; HTML mode is used for displaying it to the user in edit preview.
  • $localize: If false, $report should be output in English.

See also[edit]