Jump to content

Manual:Hooks/FetchChangesList

From mediawiki.org
FetchChangesList
Available from version 1.7.0
Allows extension to modify a recent changes list for a user
Define function:
public static function onFetchChangesList( User $user, Skin $skin, ?ChangesList &$list, array $group ) { ... }
Attach hook: In extension.json:
{
	"Hooks": {
		"FetchChangesList": "MediaWiki\\Extension\\MyExtension\\Hooks::onFetchChangesList"
	}
}
Called from: File(s): changes/ChangesList.php
Function(s): newFromContext
Interface: FetchChangesListHook.php

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


Details

[edit]
  • $user: The user viewing the recent changes list.
  • $skin: The user's skin.
  • $list: The recent changes list. Defaults to null, should be returned as a ChangesList object.
  • $groups: Array of ChangesListFilterGroup objects (introduced in 1.34.0)

An extension can modify the create a $list and then return false to prevent the calling function from building a standard recent changes list. If the extension returns true, the list object will be ignored and the calling function will create its own list based on the users preferences. Make sure that the $list extends ChangesList.