MediaWiki REL1_34
CiteDataModule.php
Go to the documentation of this file.
1<?php
2
12
13 protected $targets = [ 'desktop', 'mobile' ];
14
17 $citationDefinition = json_decode(
18 $context->msg( 'cite-tool-definition.json' )
19 ->inContentLanguage()
20 ->plain()
21 );
22
23 if ( $citationDefinition === null ) {
24 $citationDefinition = json_decode(
25 $context->msg( 'visualeditor-cite-tool-definition.json' )
26 ->inContentLanguage()
27 ->plain()
28 );
29 }
30
31 $citationTools = [];
32 if ( is_array( $citationDefinition ) ) {
33 foreach ( $citationDefinition as $tool ) {
34 if ( !isset( $tool->title ) ) {
35 $tool->title = $context->msg( 'visualeditor-cite-tool-name-' . $tool->name )
36 ->text();
37 }
38 $citationTools[] = $tool;
39 }
40 }
41
42 return 've.init.platform.addMessages(' . FormatJson::encode(
43 [
44 'cite-tool-definition.json' => json_encode( $citationTools )
45 ],
46 ResourceLoader::inDebugMode()
47 ) . ');';
48 }
49
52 return [
53 'ext.visualEditor.base',
54 'ext.visualEditor.mediawiki',
55 ];
56 }
57
60 $summary = parent::getDefinitionSummary( $context );
61 $summary[] = [
62 'script' => $this->getScript( $context ),
63 ];
64 return $summary;
65 }
66
67}
Resource loader module providing extra data from the server to Cite.
getDefinitionSummary(ResourceLoaderContext $context)
Get the definition summary for this module.This is the method subclasses are recommended to use to tr...
getDependencies(ResourceLoaderContext $context=null)
Get a list of modules this module depends on.Dependency information is taken into account when loadin...
getScript(ResourceLoaderContext $context)
Get all JS for this module for a given language and skin.Includes all relevant JS except loader scrip...
Context object that contains information about the state of a specific ResourceLoader web request.
Abstraction for ResourceLoader modules, with name registration and maxage functionality.
$context
Definition load.php:45