Manual:Hooks/ShowSearchHitTitle

From Linux Web Expert

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

<translate> For more information about attaching hooks, see <tvar name=1>Manual:Hooks </tvar>.</translate>
<translate> For examples of extensions using this hook, see <tvar name=cat>Category:ShowSearchHitTitle extensions</tvar>.</translate>


Details

  • &$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.