Manual:Hooks/CategoryViewer::doCategoryQuery

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": "MyExtensionHooks::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.

DetailsEdit

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