Manual:Hooks/ParserFetchTemplate

ParserFetchTemplate
Available from version 1.28.0 (Gerrit change 307073)
Removed in version 1.37.0 (Gerrit change 678414)
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": "MediaWiki\\Extension\\MyExtension\\Hooks::onParserFetchTemplate"
	}
}
Called from: File(s): parser/Parser.php
Function(s): statelessFetchTemplate
Interface: ParserFetchTemplateHook.php

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


Details edit

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

See also edit