Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
CodeEditorHooks | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
6 | |
0.00% |
0 / 1 |
onCodeEditorGetPageLanguage | |
0.00% |
0 / 2 |
|
0.00% |
0 / 1 |
6 |
1 | <?php |
2 | |
3 | namespace MediaWiki\Extension\UploadWizard; |
4 | |
5 | use MediaWiki\Extension\CodeEditor\Hooks\CodeEditorGetPageLanguageHook; |
6 | use MediaWiki\Title\Title; |
7 | |
8 | /** |
9 | * All hooks from the CodeEditor extension which is optional to use with this extension. |
10 | * |
11 | * @file |
12 | * @ingroup Extensions |
13 | * @ingroup UploadWizard |
14 | * |
15 | * @author Ori Livneh <ori@wikimedia.org> |
16 | */ |
17 | |
18 | class CodeEditorHooks implements CodeEditorGetPageLanguageHook { |
19 | /** |
20 | * Declares JSON as the code editor language for Campaign: pages. |
21 | * This hook only runs if the CodeEditor extension is enabled. |
22 | * @param Title $title |
23 | * @param string|null &$lang Page language. |
24 | * @param string $model |
25 | * @param string $format |
26 | */ |
27 | public function onCodeEditorGetPageLanguage( Title $title, ?string &$lang, string $model, string $format ): void { |
28 | if ( $title->inNamespace( NS_CAMPAIGN ) ) { |
29 | $lang = 'json'; |
30 | } |
31 | } |
32 | } |