mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/ConfirmEdit
synced 2024-11-24 00:04:15 +00:00
27d3b30321
Change-Id: I141399ab639edd04528af767948b27b92fdcf87c
25 lines
727 B
PHP
25 lines
727 B
PHP
<?php
|
|
|
|
namespace MediaWiki\Extension\ConfirmEdit\Turnstile;
|
|
|
|
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' ) === Turnstile::class ) {
|
|
$vars['wgConfirmEditConfig'] = [
|
|
'turnstileSiteKey' => $config->get( 'TurnstileSiteKey' ),
|
|
'turnstileScriptURL' => 'https://challenges.cloudflare.com/turnstile/v0/api.js'
|
|
];
|
|
}
|
|
}
|
|
}
|