diff --git a/extension.json b/extension.json index caa1f91..3159b08 100644 --- a/extension.json +++ b/extension.json @@ -34,9 +34,12 @@ "TextExtracts\\": "includes/" }, "Hooks": { - "ApiOpenSearchSuggest": [ - "TextExtracts\\Hooks::onApiOpenSearchSuggest" - ] + "ApiOpenSearchSuggest": "main" + }, + "HookHandlers": { + "main": { + "class": "TextExtracts\\Hooks" + } }, "config": { "ExtractsRemoveClasses": { diff --git a/includes/Hooks.php b/includes/Hooks.php index 9be5722..e55b119 100644 --- a/includes/Hooks.php +++ b/includes/Hooks.php @@ -5,19 +5,20 @@ namespace TextExtracts; use ApiBase; use ApiMain; use ApiResult; +use MediaWiki\Api\Hook\ApiOpenSearchSuggestHook; use MediaWiki\MediaWikiServices; use MediaWiki\Request\FauxRequest; /** * @license GPL-2.0-or-later */ -class Hooks { +class Hooks implements ApiOpenSearchSuggestHook { /** * ApiOpenSearchSuggest hook handler * @param array &$results Array of search results */ - public static function onApiOpenSearchSuggest( &$results ) { + public function onApiOpenSearchSuggest( &$results ) { $config = MediaWikiServices::getInstance()->getConfigFactory()->makeConfig( 'textextracts' ); if ( !$config->get( 'ExtractsExtendOpenSearchXml' ) || $results === [] ) { return;