mediawiki-extensions-Confir.../hCaptcha/includes/Hooks/ResourceLoaderHooks.php
alistair3149 b5675a9068 Use ResourceLoader callback to retrieve hCaptcha config
The old method is returning null, results in error that makes
user stuck on the save your chagnes dialog in VE.

Bug: T311449
Change-Id: I124093fff4f7e69f7ec76cc6b9994d7939bc80f1
(cherry picked from commit 2de530d092)
2022-12-13 20:52:16 +00:00

27 lines
592 B
PHP

<?php
declare( strict_types=1 );
namespace MediaWiki\Extension\ConfirmEdit\hCaptcha\Hooks;
use Config;
use MediaWiki\ResourceLoader as RL;
class ResourceLoaderHooks {
/**
* Passes config variables to ext.confirmEdit.hCaptcha.visualEditor ResourceLoader module.
* @param RL\Context $context
* @param Config $config
* @return array
*/
public static function getHCaptchaResourceLoaderConfig(
RL\Context $context,
Config $config
) {
return [
'hCaptchaSiteKey' => $config->get( 'HCaptchaSiteKey' ),
'hCaptchaScriptURL' => 'https://js.hcaptcha.com/1/api.js',
];
}
}