Customise display of thread search result titles.
authorAndrew Garrett <werdna@users.mediawiki.org>
Fri, 14 Aug 2009 16:06:11 +0000 (16:06 +0000)
committerAndrew Garrett <werdna@users.mediawiki.org>
Fri, 14 Aug 2009 16:06:11 +0000 (16:06 +0000)
* Show the subject, not the title.
* Link to the post in context, not by itself.

docs/hooks.txt
includes/specials/SpecialSearch.php

index cfb1b46..2362262 100644 (file)
@@ -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,
index da7f0d3..cbdd337 100644 (file)
@@ -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
                );