mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/CategoryTree
synced 2024-11-27 09:43:06 +00:00
Get parameters from config instead of global variable in getDataForJs()
Change-Id: Ie01fa1181f6c0878686f056e0a70f89766c090e6
This commit is contained in:
parent
75c2c5580a
commit
292f21fc38
|
@ -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(),
|
||||
|
|
Loading…
Reference in a new issue