Jump to content

Manual:Hooks/ShowSearchHitTitle

From mediawiki.org
ShowSearchHitTitle
Available from version 1.16.0
Customize display of search hit title/link.
Define function:
public static function onShowSearchHitTitle( Title &$title, &$titleSnippet, SearchResult $result, $terms, SpecialSearch $specialSearch, array &$query, array &$attributes ) { ... }
Attach hook: In extension.json:
{
	"Hooks": {
		"ShowSearchHitTitle": "MediaWiki\\Extension\\MyExtension\\Hooks::onShowSearchHitTitle"
	}
}
Called from: File(s): widget/search/FullSearchResultWidget.php
Interface: ShowSearchHitTitleHook.php

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


Details

[edit]
  • &$title: Title to link to
  • &$titleSnippet: Label for the link representing the search result. Typically the article title.
  • $result: The SearchResult object
  • $terms: String of the search terms entered
  • $specialSearch: The SpecialSearch object
  • &$query: Array of query string parameters for the link representing the search result.
  • &$attributes: Array of title link attributes, can be modified by extension.