From 9a29dae0df38491beb2785640725b04644e3686e Mon Sep 17 00:00:00 2001 From: Andrew Garrett Date: Fri, 14 Aug 2009 16:06:11 +0000 Subject: [PATCH] Customise display of thread search result titles. * Show the subject, not the title. * Link to the post in context, not by itself. --- docs/hooks.txt | 7 +++++++ includes/specials/SpecialSearch.php | 7 ++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/docs/hooks.txt b/docs/hooks.txt index cfb1b46890..2362262d08 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -1235,6 +1235,13 @@ $text: Text being shown $title: Title of the custom script/stylesheet page $output: Current OutputPage object +'ShowSearchHitTitle': Customise display of search hit title/link. +&$title: Title to link to +&$text: Text to use for the link +$result: The search result +$terms: The search terms entered +$page: The SpecialSearch object. + 'SiteNoticeBefore': Before the sitenotice/anonnotice is composed &$siteNotice: HTML returned as the sitenotice Return true to allow the normal method of notice selection/rendering to work, diff --git a/includes/specials/SpecialSearch.php b/includes/specials/SpecialSearch.php index da7f0d3174..cbdd337345 100644 --- a/includes/specials/SpecialSearch.php +++ b/includes/specials/SpecialSearch.php @@ -439,9 +439,14 @@ class SpecialSearch { if( $titleSnippet == '' ) $titleSnippet = null; + + $link_t = clone $t; + + wfRunHooks( 'ShowSearchHitTitle', + array( &$link_t, &$titleSnippet, $result, $terms, $this ) ); $link = $this->sk->linkKnown( - $t, + $link_t, $titleSnippet ); -- 2.20.1