Manual:Hooks/PageRenderingHash

From Linux Web Expert

The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
PageRenderingHash
<translate> Available from <tvar name=1><translate> version <tvar </tvar></translate>
Alter the parser cache option hash key
<translate> Define function:</translate>
public static function onPageRenderingHash( &$confstr, User $user, &$forOptions ) { ... }
<translate> Attach hook:</translate> <translate> In <tvar name=1>extension.json</tvar>:</translate>
{
	"Hooks": {
		"PageRenderingHash": "MediaWiki\\Extension\\MyExtension\\Hooks::onPageRenderingHash"
	}
}
<translate> Called from:</translate> <translate> File(s):</translate> ParserOptions.php
<translate> Interface:</translate> PageRenderingHashHook.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:PageRenderingHash extensions</tvar>.</translate>

Details

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.