Jump to content

Manual:Hooks/ParserBeforePreprocess

From wikiNonStop
Revision as of 17:03, 29 December 2024 by Majestix (talk | contribs) (1 revision imported: Initial )
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
ParserBeforePreprocess
<translate> Available from <tvar name=1><translate> version <tvar (Gerrit change 589458)</tvar></translate>
Called at the beginning of Parser::preprocess()
<translate> Define function:</translate>
public static function onParserBeforePreprocess( Parser $parser, string &$text, StripState $stripState ) { ... }
<translate> Attach hook:</translate> <translate> In <tvar name=1>extension.json</tvar>:</translate>
{
	"Hooks": {
		"ParserBeforePreprocess": "MediaWiki\\Extension\\MyExtension\\Hooks::onParserBeforePreprocess"
	}
}
<translate> Called from:</translate> <translate> File(s):</translate> parser/Parser.php
<translate> Function(s):</translate> preprocess
<translate> Interface:</translate> ParserBeforePreprocessHook.php

<translate> For more information about attaching hooks, see <tvar name=1>Manual:Hooks </tvar>.</translate>
<translate> For examples of extensions using this hook, see <tvar name=cat>Category:ParserBeforePreprocess extensions</tvar>.</translate>


Parameters

  • $parser: An instance of Parser
  • &$text: A modifiable string, representing the text to parse
  • $stripState: An instance of StripState