Jump to content

Manual:Hooks/CategoryViewer::doCategoryQuery

From mediawiki.org
CategoryViewer::doCategoryQuery
Available from version 1.25.0 (Gerrit change 188310)
Occurs after querying for pages to be displayed in a Category page
Define function:
public static function onCategoryViewer_doCategoryQuery( string $type, IResultWrapper $result ) { ... }
Attach hook: In extension.json:
{
	"Hooks": {
		"CategoryViewer::doCategoryQuery": "MediaWiki\\Extension\\MyExtension\\Hooks::onCategoryViewerdoCategoryQuery"
	}
}
Called from: File(s): CategoryViewer.php
Function(s): doCategoryQuery
Interface: CategoryViewer__doCategoryQueryHook.php

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


This hook gives extensions the opportunity to batch load any related data about the pages.

Details

[edit]
  • $type: The category type as a string. Either 'page', 'file' or 'subcat'
  • $result: IResultWrapper instance, a query result from Wikimedia\Rdbms\IDatabase::select()