[go: up one dir, main page]

Jump to content

Manual:Hooks/BeforeParserFetchTemplateAndtitle

From mediawiki.org
BeforeParserFetchTemplateAndtitle
Available from version 1.10.1
Removed in version 1.40.0 (Gerrit change 860937)
Allows an extension to specify a version of a page to get for inclusion in a template
Define function:
public static function onBeforeParserFetchTemplateAndtitle( Parser $parser, $title, &$skip, &$id ) { ... }
Attach hook: In extension.json:
{
	"Hooks": {
		"BeforeParserFetchTemplateAndtitle": "MediaWiki\\Extension\\MyExtension\\Hooks::onBeforeParserFetchTemplateAndtitle"
	}
}
Called from: File(s): parser/Parser.php
Interface: BeforeParserFetchTemplateAndtitleHook.php

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


Parameters

[edit]
  • $parser: Parser object, used to pass the context of the page whose parsing is calling this hook
  • $title: Title object, used to pass the page to be transcluded
  • &$skip: Defaults to false, which lets the transclusion continue; if set to true, will replace the transclusion with a simple wiki link to the title
  • &$id: Defaults to false, which will cause the most recent revision to be fetched; if set to a revision ID, will fetch that revision instead