Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 8 |
|
0.00% |
0 / 3 |
CRAP | |
0.00% |
0 / 1 |
QuickSearchLookupHooks | |
0.00% |
0 / 8 |
|
0.00% |
0 / 3 |
30 | |
0.00% |
0 / 1 |
onShowSearchHitTitle | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
6 | |||
onSpecialSearchSetupEngine | |
0.00% |
0 / 4 |
|
0.00% |
0 / 1 |
6 | |||
onSpecialSearchResultsAppend | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | |
3 | class QuickSearchLookupHooks { |
4 | /** |
5 | * If there isn't a first title already, set it here. |
6 | * |
7 | * @param Title &$title Title object of the list item |
8 | * @param string &$text Text to use for the link |
9 | * @param Result $result |
10 | * @param Terms $terms |
11 | * @param Page $page |
12 | */ |
13 | public static function onShowSearchHitTitle( &$title, &$text, $result, $terms, $page ) { |
14 | $qsl = QuickSearchLookup::getMain(); |
15 | if ( $qsl->needsFirstResult() ) { |
16 | $qsl->setFirstResult( $title ); |
17 | } |
18 | } |
19 | |
20 | /** |
21 | * If there isn't a first title already, set it here. |
22 | * |
23 | * @param SpecialSearch $page |
24 | * @param string $profile current search profile |
25 | * @param SearchEngine $searchEngine the search engine |
26 | */ |
27 | public static function onSpecialSearchSetupEngine( SpecialSearch $page, $profile, $searchEngine ) { |
28 | $qsl = QuickSearchLookup::getMain(); |
29 | if ( $qsl->needsFirstResult() ) { |
30 | $term = str_replace( "\n", " ", $page->getRequest()->getText( 'search' ) ); |
31 | $qsl->setFirstResult( $term ); |
32 | } |
33 | } |
34 | |
35 | /** |
36 | * Output the panel afterthe search results. |
37 | * |
38 | * @param SpecialSearch $specialSearch |
39 | * @param OutputPage $output |
40 | */ |
41 | public static function onSpecialSearchResultsAppend( SpecialSearch $specialSearch, OutputPage $output ) { |
42 | QuickSearchLookup::getMain()->outputLookup( $output ); |
43 | } |
44 | |
45 | } |