| 1 | <?php |
| 2 | |
| 3 | namespace MediaWiki\Hook; |
| 4 | |
| 5 | use MediaWiki\Title\Title; |
| 6 | |
| 7 | /** |
| 8 | * This is a hook handler interface, see docs/Hooks.md. |
| 9 | * Use the hook name "SpecialSearchGoResult" to register handlers implementing this interface. |
| 10 | * |
| 11 | * @stable to implement |
| 12 | * @ingroup Hooks |
| 13 | */ |
| 14 | interface SpecialSearchGoResultHook { |
| 15 | /** |
| 16 | * Use this hook to alter the behaviour of the 'go' feature when searching |
| 17 | * |
| 18 | * If a hook returns false the 'go' feature will be canceled and a normal search will be |
| 19 | * performed. Returning true without setting $url does a standard redirect to $title. |
| 20 | * Setting $url redirects to the specified URL. |
| 21 | * |
| 22 | * @since 1.35 |
| 23 | * |
| 24 | * @param string $term The string the user searched for |
| 25 | * @param Title $title The title the 'go' feature has decided to forward the user to |
| 26 | * @param string|null &$url Initially null, hook subscribers can set this to specify |
| 27 | * the final url to redirect to |
| 28 | * @return bool|void True or no return value to continue or false to abort |
| 29 | */ |
| 30 | public function onSpecialSearchGoResult( $term, $title, &$url ); |
| 31 | } |