Manual:Hooks/BeforeParserFetchFileAndTitle

From MediaWiki.org
Jump to navigation Jump to search
BeforeParserFetchFileAndTitle
Available from version 1.18.0 (r84659)
Before an image is rendered by Parser.
Define function:
public static function onBeforeParserFetchFileAndTitle( Parser $parser, $nt, array &$options, string &$descQuery ) { ... }
Attach hook:

In extension.json:

{
	"Hooks": {
		"BeforeParserFetchFileAndTitle": "MyExtensionHooks::onBeforeParserFetchFileAndTitle"
	}
}

For MediaWiki ≤1.25:

$wgHooks['BeforeParserFetchFileAndTitle'][] = 'MyExtensionHooks::onBeforeParserFetchFileAndTitle';
Called from:File(s): parser/Parser.php

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

Details[edit]

  • $parser: Parser object
  • $nt: the image title
  • &$options: array of options to use to Parser::fetchFileAndTitle
  • &$descQuery: query string to add to thumbnail URL