| 1 | <?php |
| 2 | |
| 3 | namespace MediaWiki\Api\Hook; |
| 4 | |
| 5 | /** |
| 6 | * This is a hook handler interface, see docs/Hooks.md. |
| 7 | * Use the hook name "ApiOpenSearchSuggest" to register handlers implementing this interface. |
| 8 | * |
| 9 | * @stable to implement |
| 10 | * @ingroup Hooks |
| 11 | */ |
| 12 | interface ApiOpenSearchSuggestHook { |
| 13 | /** |
| 14 | * This hook is called when constructing the OpenSearch results. Hooks |
| 15 | * can alter or append to the array. |
| 16 | * |
| 17 | * @since 1.35 |
| 18 | * |
| 19 | * @param array[] &$results Array with integer keys to associative arrays. |
| 20 | * Keys in associative array: |
| 21 | * - `title`: Title object |
| 22 | * - `redirect from`: Title or null |
| 23 | * - `extract`: Description for this result |
| 24 | * - `extract trimmed`: If truthy, the extract will not be trimmed to |
| 25 | * $wgOpenSearchDescriptionLength. |
| 26 | * - `image`: Thumbnail for this result. Value is an array with subkeys `source` |
| 27 | * (URL), `width`, `height`, `alt`, and `align`. |
| 28 | * - `url`: URL for the given title |
| 29 | * @return bool|void True or no return value to continue or false to abort |
| 30 | */ |
| 31 | public function onApiOpenSearchSuggest( &$results ); |
| 32 | } |