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"
	}
}
Called from:File(s): ParserOptions.php
Interface:PageRenderingHashHook.php

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

Details[edit]

NOTE: Consider using ParserOptionsRegister instead.

  • &$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.