Manual:Hooks/ParserCloned

ParserCloned
Available from version 1.21.0 (Gerrit change 33506)
called when the Parser is cloned
Define function:
public static function onParserCloned( $parser ) { ... }
Attach hook: In extension.json:
{
	"Hooks": {
		"ParserCloned": "MediaWiki\\Extension\\MyExtension\\Hooks::onParserCloned"
	}
}
Called from: File(s): Parser.php
Interface: ParserClonedHook.php

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


Details edit

$parser: Newly-cloned Parser object

Purpose edit

Extensions should use this hook if they store per-instance data in "expando" properties on the Parser object that need to be deep-cloned or cleared for the new Parser object.