Manual:Hooks/ApiFeedContributions::feedItem

From MediaWiki.org
Jump to navigation Jump to search
ApiFeedContributions::feedItem
Available from version 1.25.0 (r185062)
Called to convert the result of ContribsPager into a FeedItem instance that ApiFeedContributions can consume.
Define function:
public static function onApiFeedContributions_feedItem( object $row, FeedItem &feedItem = null ) { ... }
Attach hook:

In extension.json:

{
	"Hooks": {
		"ApiFeedContributions::feedItem": "MyExtensionHooks::onApiFeedContributionsfeedItem"
	}
}

For MediaWiki ≤1.25:

$wgHooks['ApiFeedContributions::feedItem'][] = 'MyExtensionHooks::onApiFeedContributionsfeedItem';
Called from:File(s): api/ApiFeedContributions.php

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

Details[edit]

  • &$namespaces: Array of namespace numbers with corresponding canonical names
  • $row: A row of data from ContribsPager. The set of data returned by ContribsPager can be adjusted by handling the ContribsPager::reallyDoQuery hook.
  • &$feedItem: Set this to a FeedItem instance if the hook can handle the provided row. This is provided to the hook as a null, if it is non null then another hook has already handled the hook.