Manual:Hooks/ParserOptionsRegister

From MediaWiki.org
Jump to navigation Jump to search
ParserOptionsRegister
Available from version 1.30.0
allows registering additional parser options
Define function:
public static function onParserOptionsRegister( &$defaults, &$inCacheKey, &$lazyLoad ) { ... }
Attach hook:

In extension.json:

{
	"Hooks": {
		"ParserOptionsRegister": "MyExtensionHooks::onParserOptionsRegister"
	}
}

For MediaWiki ≤1.25:

$wgHooks['ParserOptionsRegister'][] = 'MyExtensionHooks::onParserOptionsRegister';
Called from:File(s): parser/ParserOptions.php
Function(s): getDefaults

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

Parameters[edit]

  • &$defaults: Options and their defaults
  • &$inCacheKey: Whether each option splits the parser cache
  • &$lazyOptions: Initializers for lazy-loaded options