| 1 | <?php |
| 2 | |
| 3 | namespace MediaWiki\Search\Hook; |
| 4 | |
| 5 | use HtmlArmor; |
| 6 | use MediaWiki\Specials\SpecialSearch; |
| 7 | use MediaWiki\Title\Title; |
| 8 | use SearchResult; |
| 9 | |
| 10 | /** |
| 11 | * This is a hook handler interface, see docs/Hooks.md. |
| 12 | * Use the hook name "ShowSearchHitTitle" to register handlers implementing this interface. |
| 13 | * |
| 14 | * @stable to implement |
| 15 | * @ingroup Hooks |
| 16 | */ |
| 17 | interface ShowSearchHitTitleHook { |
| 18 | /** |
| 19 | * Use this hook to customise display of search hit title/link. |
| 20 | * |
| 21 | * @since 1.35 |
| 22 | * |
| 23 | * @param Title &$title Title to link to |
| 24 | * @param string|HtmlArmor|null &$titleSnippet Label for the link representing |
| 25 | * the search result. Typically the article title. |
| 26 | * @param SearchResult $result |
| 27 | * @param array $terms Array of search terms extracted by SearchDatabase search engines |
| 28 | * (may not be populated by other search engines) |
| 29 | * @param SpecialSearch $specialSearch |
| 30 | * @param string[] &$query Array of query string parameters for the link representing the search |
| 31 | * result |
| 32 | * @param string[] &$attributes Array of title link attributes, can be modified by extension |
| 33 | * @return bool|void True or no return value to continue or false to abort |
| 34 | */ |
| 35 | public function onShowSearchHitTitle( &$title, &$titleSnippet, $result, $terms, |
| 36 | $specialSearch, &$query, &$attributes |
| 37 | ); |
| 38 | } |