mediawiki-extensions-Confir.../ReCaptchaNoCaptcha/includes/Hooks.php
Fomafix 27d3b30321 Replace global configuration variables by Config
Change-Id: I141399ab639edd04528af767948b27b92fdcf87c
2024-09-30 06:53:20 +00:00

25 lines
734 B
PHP

<?php
namespace MediaWiki\Extension\ConfirmEdit\ReCaptchaNoCaptcha;
use MediaWiki\Config\Config;
use MediaWiki\ResourceLoader\Hook\ResourceLoaderGetConfigVarsHook;
class Hooks implements ResourceLoaderGetConfigVarsHook {
/**
* Adds extra variables to the global config
*
* @param array &$vars Global variables object
* @param string $skin
* @param Config $config
*/
public function onResourceLoaderGetConfigVars( array &$vars, $skin, Config $config ): void {
if ( $config->get( 'CaptchaClass' ) === ReCaptchaNoCaptcha::class ) {
$vars['wgConfirmEditConfig'] = [
'reCaptchaSiteKey' => $config->get( 'ReCaptchaSiteKey' ),
'reCaptchaScriptURL' => 'https://www.recaptcha.net/recaptcha/api.js'
];
}
}
}