mediawiki-extensions-Visual.../includes/EditCheck/ResourceLoaderData.php
Ed Sanders a59335fac6 Rename config.references to config.addReference
Change-Id: I5e4b70d8bff1e9b26ca78f9f6f8c9ac8d5f7297b
2023-09-01 13:41:52 +01:00

33 lines
770 B
PHP

<?php
/**
* Utilities for ResourceLoader modules used by EditCheck.
*
* @file
* @ingroup Extensions
* @license MIT
*/
namespace MediaWiki\Extension\VisualEditor\EditCheck;
use MessageLocalizer;
class ResourceLoaderData {
protected static array $defaults = [
'addReference' => [
'minimumCharacters' => 50,
],
];
/**
* Return configuration data for edit checks, fetched from an on-wiki JSON message
*
* @param MessageLocalizer $context
* @return array Configuration data for edit checks
*/
public static function getConfig( MessageLocalizer $context ) {
$raw_config = json_decode( $context->msg( 'editcheck-config.json' )->inContentLanguage()->plain(), true );
return array_replace_recursive( self::$defaults, $raw_config ?? [] );
}
}