Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 12 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
EventDetailsHandler | |
0.00% |
0 / 12 |
|
0.00% |
0 / 2 |
30 | |
0.00% |
0 / 1 |
__construct | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
onCampaignEventsGetEventDetails | |
0.00% |
0 / 11 |
|
0.00% |
0 / 1 |
20 |
1 | <?php |
2 | |
3 | declare( strict_types=1 ); |
4 | |
5 | namespace MediaWiki\Extension\WikimediaCampaignEvents\Hooks\Handlers; |
6 | |
7 | use MediaWiki\Extension\CampaignEvents\FrontendModules\EventDetailsModule; |
8 | use MediaWiki\Extension\CampaignEvents\Hooks\CampaignEventsGetEventDetailsHook; |
9 | use MediaWiki\Extension\WikimediaCampaignEvents\Grants\GrantsStore; |
10 | use MediaWiki\Output\OutputPage; |
11 | use OOUI\Tag; |
12 | |
13 | class EventDetailsHandler implements CampaignEventsGetEventDetailsHook { |
14 | private GrantsStore $grantsStore; |
15 | |
16 | public function __construct( |
17 | GrantsStore $grantsStore |
18 | ) { |
19 | $this->grantsStore = $grantsStore; |
20 | } |
21 | |
22 | /** |
23 | * @inheritDoc |
24 | */ |
25 | public function onCampaignEventsGetEventDetails( |
26 | Tag $infoColumn, |
27 | Tag $organizersColumn, |
28 | int $eventID, |
29 | bool $isOrganizer, |
30 | OutputPage $outputPage, |
31 | bool $isLocalWiki |
32 | ): void { |
33 | if ( !$isOrganizer || !$isLocalWiki ) { |
34 | return; |
35 | } |
36 | $grantID = $this->grantsStore->getGrantID( $eventID ); |
37 | if ( $grantID ) { |
38 | $outputPage->addModuleStyles( 'oojs-ui.styles.icons-editing-advanced' ); |
39 | |
40 | $grantIDElement = EventDetailsModule::makeSection( |
41 | 'templateAdd', |
42 | $grantID, |
43 | $outputPage->msg( 'wikimediacampaignevents-grant-id-event-details-label' )->text() |
44 | ); |
45 | |
46 | $organizersColumn->appendContent( $grantIDElement ); |
47 | } |
48 | } |
49 | } |