3 * Resource loader module providing extra data from the server to Cite.
5 * Temporary hack for T93800
9 * @copyright 2011-2017 Cite VisualEditor Team and others; see AUTHORS.txt
10 * @license The MIT License (MIT); see MIT-LICENSE.txt
13 class CiteDataModule extends ResourceLoaderModule {
15 /* Protected Members */
17 protected $origin = self::ORIGIN_USER_SITEWIDE;
18 protected $targets = [ 'desktop', 'mobile' ];
22 public function getScript( ResourceLoaderContext $context ) {
23 $citationDefinition = json_decode(
24 $context->msg( 'cite-tool-definition.json' )
29 if ( $citationDefinition === null ) {
30 $citationDefinition = json_decode(
31 $context->msg( 'visualeditor-cite-tool-definition.json' )
38 if ( is_array( $citationDefinition ) ) {
39 foreach ( $citationDefinition as $tool ) {
40 if ( !isset( $tool->title ) ) {
41 $tool->title = $context->msg( 'visualeditor-cite-tool-name-' . $tool->name )
44 $citationTools[] = $tool;
49 've.init.platform.addMessages(' . FormatJson::encode(
51 'cite-tool-definition.json' => json_encode( $citationTools )
53 ResourceLoader::inDebugMode()
57 public function getDependencies( ResourceLoaderContext $context = null ) {
59 'ext.visualEditor.base',
60 'ext.visualEditor.mediawiki',
64 public function getDefinitionSummary( ResourceLoaderContext $context ) {
65 $summary = parent::getDefinitionSummary( $context );
67 'script' => $this->getScript( $context ),