mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/DiscussionTools
synced 2024-11-28 02:00:57 +00:00
64bcb583e9
Done automatically via script Change to extension.json done manually Change-Id: Ied7bbddd357290ac6be6bf480be0ee9116e77365
44 lines
1.1 KiB
PHP
44 lines
1.1 KiB
PHP
<?php
|
|
/**
|
|
* DiscussionTools resource loader hooks
|
|
*
|
|
* @file
|
|
* @ingroup Extensions
|
|
* @license MIT
|
|
*/
|
|
|
|
namespace MediaWiki\Extension\DiscussionTools\Hooks;
|
|
|
|
use MediaWiki\Config\Config;
|
|
use MediaWiki\Config\ConfigFactory;
|
|
use MediaWiki\ResourceLoader\Hook\ResourceLoaderGetConfigVarsHook;
|
|
|
|
class ResourceLoaderHooks implements
|
|
ResourceLoaderGetConfigVarsHook
|
|
{
|
|
|
|
private Config $config;
|
|
|
|
public function __construct(
|
|
ConfigFactory $configFactory
|
|
) {
|
|
$this->config = $configFactory->makeConfig( 'discussiontools' );
|
|
}
|
|
|
|
/**
|
|
* Set static (not request-specific) JS configuration variables
|
|
*
|
|
* @see https://www.mediawiki.org/wiki/Manual:Hooks/ResourceLoaderGetConfigVars
|
|
* @param array &$vars Array of variables to be added into the output of the startup module
|
|
* @param string $skin Current skin name to restrict config variables to a certain skin
|
|
* @param Config $config
|
|
*/
|
|
public function onResourceLoaderGetConfigVars( array &$vars, $skin, Config $config ): void {
|
|
$abtest = $this->config->get( 'DiscussionToolsABTest' );
|
|
if ( $abtest ) {
|
|
$vars['wgDiscussionToolsABTest'] = $abtest;
|
|
}
|
|
}
|
|
|
|
}
|