Manual:Hooks/ApiQueryBaseProcessRow

From MediaWiki.org
Jump to navigation Jump to search
ApiQueryBaseProcessRow
Available from version 1.28.0 (Gerrit change 313830)
Called for (some) API query modules as each row of the database result is processed.
Define function:
public static function onApiQueryBaseProcessRow( $this, $row, &$data, &$hookData ) { ... }
Attach hook:

In extension.json:

{
	"Hooks": {
		"ApiQueryBaseProcessRow": "MyExtensionHooks::onApiQueryBaseProcessRow"
	}
}

For MediaWiki ≤1.25:

$wgHooks['ApiQueryBaseProcessRow'][] = 'MyExtensionHooks::onApiQueryBaseProcessRow';
Called from:File(s): api/ApiQueryBase.php
Function(s): processRow

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

Called for (some) API query modules as each row of the database result is processed. Return false to stop processing the result set. An API query module wanting to use this hook should see the ApiQueryBase::select() and ApiQueryBase::processRow() documentation.

Details[edit]

  • $module: ApiQueryBase module in question
  • $row: stdClass Database result row
  • &$data: array to be included in the ApiResult.
  • &$hookData: array that was be passed to the ApiQueryBaseBeforeQuery and ApiQueryBaseAfterQuery hooks, intended for inter-hook communication.