mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-12-19 09:41:09 +00:00
a798721e23
Bug: T344962 Change-Id: Ib4ae46d423e69c0bb45a2b1fa1c23fa7e84a8077
34 lines
802 B
PHP
34 lines
802 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,
|
|
'beforePunctuation' => false
|
|
],
|
|
];
|
|
|
|
/**
|
|
* 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 ?? [] );
|
|
}
|
|
}
|