Manual:Hooks/ParserOptionsRegister

From Linux Web Expert

ParserOptionsRegister
<translate> Available from <tvar name=1><translate> version <tvar </tvar></translate>
allows registering additional parser options
<translate> Define function:</translate>
public static function onParserOptionsRegister( &$defaults, &$inCacheKey, &$lazyLoad ) { ... }
<translate> Attach hook:</translate> <translate> In <tvar name=1>extension.json</tvar>:</translate>
{
	"Hooks": {
		"ParserOptionsRegister": "MediaWiki\\Extension\\MyExtension\\Hooks::onParserOptionsRegister"
	}
}
<translate> Called from:</translate> <translate> File(s):</translate> parser/ParserOptions.php
<translate> Function(s):</translate> getDefaults
<translate> Interface:</translate> ParserOptionsRegisterHook.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:ParserOptionsRegister extensions</tvar>.</translate>


Parameters

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