Manual:Hooks/InfoAction

From Linux Web Expert

InfoAction
<translate> Available from <tvar name=1><translate> version <tvar (Gerrit change 26743)</tvar></translate>
When building information to display on the action=info page
<translate> Define function:</translate>
public static function onInfoAction( IContextSource $context, array &$pageInfo ) { ... }
<translate> Attach hook:</translate> <translate> In <tvar name=1>extension.json</tvar>:</translate>
{
	"Hooks": {
		"InfoAction": "MediaWiki\\Extension\\MyExtension\\Hooks::onInfoAction"
	}
}
<translate> Called from:</translate> <translate> File(s):</translate> actions/InfoAction.php
<translate> Interface:</translate> InfoActionHook.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:InfoAction extensions</tvar>.</translate>


Details

  • $context: IContextSource object
  • &$pageInfo: Array of information

$pageInfo is an array of info groups (with string key; the section title for the group will be taken from the plaintext message pageinfo-$key). Each info group is an array of info items (with numeric keys). Each info item is a two-element array (with numeric keys); the first element is the type of the information, the second the value. Both can be strings or HTML messages.

The info group keys used by core are: header-basic, header-edits, header-restrictions, header-properties, category-info. Extensions can extend those groups or add new ones.