| 1 | <?php |
| 2 | |
| 3 | namespace MediaWiki\Search\Hook; |
| 4 | |
| 5 | use MediaWiki\Specials\SpecialSearch; |
| 6 | use SearchResult; |
| 7 | |
| 8 | /** |
| 9 | * This is a hook handler interface, see docs/Hooks.md. |
| 10 | * Use the hook name "ShowSearchHit" to register handlers implementing this interface. |
| 11 | * |
| 12 | * @stable to implement |
| 13 | * @ingroup Hooks |
| 14 | */ |
| 15 | interface ShowSearchHitHook { |
| 16 | /** |
| 17 | * Use this hook to customize display of search hit. |
| 18 | * |
| 19 | * @since 1.35 |
| 20 | * |
| 21 | * @param SpecialSearch $searchPage |
| 22 | * @param SearchResult $result SearchResult to show |
| 23 | * @param string[] $terms Search terms, for highlighting (unreliable as search engine dependent) |
| 24 | * @param string &$link HTML of link to the matching page. May be modified. |
| 25 | * @param string &$redirect HTML of redirect info. May be modified. |
| 26 | * @param string &$section HTML of matching section. May be modified. |
| 27 | * @param string &$extract HTML of content extract. May be modified. |
| 28 | * @param string &$score HTML of score. May be modified. |
| 29 | * @param string &$size HTML of page size. May be modified. |
| 30 | * @param string &$date HTML of page modification date. May be modified. |
| 31 | * @param string &$related HTML of additional info for the matching page. May be modified. |
| 32 | * @param string &$html May be set to the full HTML that should be used to represent the search |
| 33 | * hit. Must include the `<li> ... </li>` tags. Will only be used if the hook |
| 34 | * function returned false. |
| 35 | * @return bool|void True or no return value to continue or false to abort |
| 36 | */ |
| 37 | public function onShowSearchHit( $searchPage, $result, $terms, &$link, |
| 38 | &$redirect, &$section, &$extract, &$score, &$size, &$date, &$related, &$html |
| 39 | ); |
| 40 | } |