Jump to content

Manual:Hooks/ApiMakeParserOptions

From mediawiki.org
ApiMakeParserOptions
Available from version 1.28.0 (Gerrit change 295256)
allows extensions to adjust the parser options before parsing
Define function:
public static function onApiMakeParserOptions( ParserOptions $options, Title $title, array $params, ApiBase $module, \Wikimedia\ScopedCallback &$reset, bool &$suppressCache ) { ... }
Attach hook: In extension.json:
{
	"Hooks": {
		"ApiMakeParserOptions": "MediaWiki\\Extension\\MyExtension\\Hooks::onApiMakeParserOptions"
	}
}
Called from: File(s): api/ApiExpandTemplates.php, api/ApiParse.php
Function(s): execute, makeParserOptions
Interface: ApiMakeParserOptionsHook.php

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


Details

[edit]
  • $options: ParserOptions object
  • $title: Title to be parsed
  • $params: Array of parameters for the API module
  • $module: ApiBase object
  • &$reset: Set to a \Wikimedia\ScopedCallback used to reset any hooks after the parse is done.
  • &$suppressCache: Set true if cache should be suppressed.