Manual:Hooks/PageRenderingHash

From MediaWiki.org
Jump to navigation Jump to search
PageRenderingHash
Available from version 1.6.0
Alter the parser cache option hash key
Define function:
public static function onPageRenderingHash( &$confstr, User $user, &$forOptions ) { ... }
Attach hook:

In extension.json:

{
	"Hooks": {
		"PageRenderingHash": "MyExtensionHooks::onPageRenderingHash"
	}
}

For MediaWiki ≤1.25:

$wgHooks['PageRenderingHash'][] = 'MyExtensionHooks::onPageRenderingHash';
Called from: File(s): ParserOptions.php

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

Details[edit]

  • &$confstr: Reference to a hash key string which can be modified
  • User $user: User object that is requesting the page
  • &$forOptions: Array of options used to generate the $confstr hash key

A parser extension which depends on user options should install this hook and append its values to the key.