Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
3 / 3 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
MobileConfig | |
100.00% |
3 / 3 |
|
100.00% |
2 / 2 |
2 | |
100.00% |
1 / 1 |
makeScript | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getConfigData | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 |
1 | <?php |
2 | |
3 | namespace MobileFrontend\ResourceLoaderModules; |
4 | |
5 | use MediaWiki\Html\Html; |
6 | use MediaWiki\ResourceLoader as RL; |
7 | use MobileFrontendEditorHooks; |
8 | use MobileFrontendHooks; |
9 | |
10 | /** |
11 | * A callback to deliver JavaScript config necessary for MobileFrontend. |
12 | */ |
13 | class MobileConfig { |
14 | /** |
15 | * @param RL\Context $context |
16 | * @return string |
17 | */ |
18 | public static function makeScript( RL\Context $context ) { |
19 | return Html::encodeJsCall( 'mw.config.set', [ self::getConfigData() ] ); |
20 | } |
21 | |
22 | /** |
23 | * @return array |
24 | */ |
25 | private static function getConfigData() { |
26 | return MobileFrontendHooks::getResourceLoaderMFConfigVars() + |
27 | MobileFrontendEditorHooks::getResourceLoaderMFConfigVars(); |
28 | } |
29 | } |