Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 9 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
DiscussionToolsHooks | |
0.00% |
0 / 9 |
|
0.00% |
0 / 1 |
20 | |
0.00% |
0 / 1 |
onDiscussionToolsAddOverflowMenuItems | |
0.00% |
0 / 9 |
|
0.00% |
0 / 1 |
20 |
1 | <?php |
2 | /** |
3 | * DiscussionTools hooks for listening to our own hooks |
4 | * |
5 | * @file |
6 | * @ingroup Extensions |
7 | * @license MIT |
8 | */ |
9 | |
10 | namespace MediaWiki\Extension\DiscussionTools\Hooks; |
11 | |
12 | use IContextSource; |
13 | use MediaWiki\Extension\DiscussionTools\OverflowMenuItem; |
14 | |
15 | class DiscussionToolsHooks implements |
16 | DiscussionToolsAddOverflowMenuItemsHook |
17 | { |
18 | |
19 | /** |
20 | * @param OverflowMenuItem[] &$overflowMenuItems |
21 | * @param string[] &$resourceLoaderModules |
22 | * @param array $threadItemData |
23 | * @param IContextSource $contextSource |
24 | * @return bool|void |
25 | */ |
26 | public function onDiscussionToolsAddOverflowMenuItems( |
27 | array &$overflowMenuItems, |
28 | array &$resourceLoaderModules, |
29 | array $threadItemData, |
30 | IContextSource $contextSource |
31 | ) { |
32 | if ( |
33 | ( $threadItemData['type'] ?? null ) === 'heading' && |
34 | !( $threadItemData['uneditableSection'] ?? false ) && |
35 | $contextSource->getSkin()->getSkinName() === 'minerva' |
36 | ) { |
37 | $overflowMenuItems[] = new OverflowMenuItem( |
38 | 'edit', |
39 | 'edit', |
40 | $contextSource->msg( 'skin-view-edit' ), |
41 | 2 |
42 | ); |
43 | } |
44 | } |
45 | } |