Jump to navigation Jump to search
Available from version 1.28.0 (Gerrit change 307073)
Called when the parser fetches a template
Define function:
public static function onParserFetchTemplate( $parser, Title $title, Revision $revision, &$text, array &$deps ) { ... }
Attach hook:

In extension.json:

	"Hooks": {
		"ParserFetchTemplate": "MyExtensionHooks::onParserFetchTemplate"

For MediaWiki ≤1.25:

$wgHooks['ParserFetchTemplate'][] = 'MyExtensionHooks::onParserFetchTemplate';
Called from:File(s): parser/Parser.php
Function(s): statelessFetchTemplate

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


  • $parser: Parser object or false
  • $title: Title object of the template to be fetched
  • $rev: Revision object of the template
  • &$text: Transclusion text of the template or false or null
  • &$deps: Array of template dependencies with 'title', 'page_id', 'rev_id' keys