Jump to content

Manual:Hooks/ArticleParserOptions

From mediawiki.org
ArticleParserOptions
Available from version 1.36.0 (Gerrit change 644573)
This hook is called before parsing wikitext for an article,
Define function:
public static function onArticleParserOptions( Article $article, ParserOptions $parserOptions ) { ... }
Attach hook: In extension.json:
{
	"Hooks": {
		"ArticleParserOptions": "MediaWiki\\Extension\\MyExtension\\Hooks::onArticleParserOptions"
	}
}
Called from: File(s): page/Article.php
Function(s): view
Interface: ArticleParserOptionsHook.php

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


This hook allows setting particular parser options based on title, user preferences, etc.

Parameters

[edit]
  • $article: The Article instance that is about to be parsed
  • $parserOptions: A mutable ParserOptions object