Update docs/hooks.txt for ShowSearchHitTitle
Reasons: * $text is vague. It's the label of the link. There is a function named getTitleSnippet, which is what I'm reusing for the variable name. * $page is vague. It's not the page of the search result, but the search special page. * $queryString is not a string but an array of strings. I also updated https://www.mediawiki.org/wiki/Manual:Hooks/ShowSearchHitTitle accordingly. Change-Id: Ia18dbf5ccf7f9fcc8890ad01641d0b7ff3e6eee8
This commit is contained in:
parent
92214baada
commit
fa6ade7262
2 changed files with 8 additions and 8 deletions
|
|
@ -2823,11 +2823,11 @@ $terms: Search terms, for highlighting
|
||||||
|
|
||||||
'ShowSearchHitTitle': Customise display of search hit title/link.
|
'ShowSearchHitTitle': Customise display of search hit title/link.
|
||||||
&$title: Title to link to
|
&$title: Title to link to
|
||||||
&$text: Text to use for the link
|
&$titleSnippet: Label for the link representing the search result. Typically the article title.
|
||||||
$result: The search result
|
$result: The SearchResult object
|
||||||
$terms: The search terms entered
|
$terms: String of the search terms entered
|
||||||
$page: The SpecialSearch object
|
$specialSearch: The SpecialSearch object
|
||||||
&$query: Query string to be appended to the link
|
&$query: Array of query string parameters for the link representing the search result.
|
||||||
|
|
||||||
'SidebarBeforeOutput': Allows to edit sidebar just before it is output by skins.
|
'SidebarBeforeOutput': Allows to edit sidebar just before it is output by skins.
|
||||||
Warning: This hook is run on each display. You should consider to use
|
Warning: This hook is run on each display. You should consider to use
|
||||||
|
|
|
||||||
|
|
@ -131,16 +131,16 @@ class FullSearchResultWidget implements SearchResultWidget {
|
||||||
|
|
||||||
// clone to prevent hook from changing the title stored inside $result
|
// clone to prevent hook from changing the title stored inside $result
|
||||||
$title = clone $result->getTitle();
|
$title = clone $result->getTitle();
|
||||||
$queryString = [];
|
$query = [];
|
||||||
|
|
||||||
Hooks::run( 'ShowSearchHitTitle',
|
Hooks::run( 'ShowSearchHitTitle',
|
||||||
[ &$title, &$snippet, $result, $terms, $this->specialPage, &$queryString ] );
|
[ &$title, &$snippet, $result, $terms, $this->specialPage, &$query ] );
|
||||||
|
|
||||||
$link = $this->linkRenderer->makeLink(
|
$link = $this->linkRenderer->makeLink(
|
||||||
$title,
|
$title,
|
||||||
$snippet,
|
$snippet,
|
||||||
[ 'data-serp-pos' => $position ],
|
[ 'data-serp-pos' => $position ],
|
||||||
$queryString
|
$query
|
||||||
);
|
);
|
||||||
|
|
||||||
return $link;
|
return $link;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue