Manual:Hooks/SearchResultInitFromTitle

From mediawiki.org
Jump to navigation Jump to search
SearchResultInitFromTitle
Available from version 1.20.0
Set the revision used when displaying a page in search results.
Define function:
public static function onSearchResultInitFromTitle( Title title, &$id ) { ... }
Attach hook:

In extension.json:

{
	"Hooks": {
		"SearchResultInitFromTitle": "MyExtensionHooks::onSearchResultInitFromTitle"
	}
}
Called from:File(s): SearchEngine.php
Interface:SearchResultInitFromTitleHook.php

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

Details[edit]

  • $title : Current Title object being displayed in search results.
  • &$id: Revision ID (default is false, for latest)