diff --git a/includes/Hooks.php b/includes/Hooks.php index 5ce9b701..c9b2ad11 100644 --- a/includes/Hooks.php +++ b/includes/Hooks.php @@ -36,6 +36,7 @@ use MediaWiki\Html\Html; use MediaWiki\Linker\LinkTarget; use MediaWiki\Output\OutputPage; use MediaWiki\Parser\Sanitizer; +use MediaWiki\ResourceLoader as RL; use MediaWiki\SpecialPage\SpecialPage; use MediaWiki\Title\Title; use Parser; @@ -236,13 +237,13 @@ class Hooks implements * Get exported data for the "ext.categoryTree" ResourceLoader module. * * @internal For use in extension.json only. + * @param RL\Context $context + * @param Config $config * @return array Data to be serialised as data.json */ - public static function getDataForJs() { - global $wgCategoryTreeCategoryPageOptions; - + public static function getDataForJs( RL\Context $context, Config $config ) { // Look, this is pretty bad but CategoryTree is just whacky, it needs to be rewritten - $ct = new CategoryTree( $wgCategoryTreeCategoryPageOptions ); + $ct = new CategoryTree( $config->get( 'CategoryTreeCategoryPageOptions' ) ); return [ 'defaultCtOptions' => $ct->getOptionsAsJsStructure(),