Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 13
0.00% covered (danger)
0.00%
0 / 1
CRAP
0.00% covered (danger)
0.00%
0 / 1
EchoHooks
0.00% covered (danger)
0.00%
0 / 13
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 1
 onBeforeCreateEchoEvent
0.00% covered (danger)
0.00%
0 / 13
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2
3namespace MediaWiki\Extension\TheWikipediaLibrary;
4
5use EchoAttributeManager;
6use EchoUserLocator;
7use MediaWiki\Extension\Notifications\Hooks\BeforeCreateEchoEventHook;
8
9/**
10 * TheWikipediaLibrary extension hooks
11 * All hooks from the Echo extension which is optional to use with this extension.
12 *
13 * @file
14 * @ingroup Extensions
15 * @license MIT
16 */
17class EchoHooks implements
18    BeforeCreateEchoEventHook
19{
20    /**
21     * Add The Wikipedia Library - eligibility events to Echo
22     *
23     * @param array &$notifications array of Echo notifications
24     * @param array &$notificationCategories array of Echo notification categories
25     * @param array &$icons array of icon details
26     */
27    public function onBeforeCreateEchoEvent(
28        array &$notifications, array &$notificationCategories, array &$icons
29    ): void {
30        $notifications['twl-eligible'] = [
31            EchoAttributeManager::ATTR_LOCATORS => [
32                [ [ EchoUserLocator::class, 'locateEventAgent' ] ],
33            ],
34            'canNotifyAgent' => true,
35            'category' => 'system-noemail',
36            'group' => 'positive',
37            'section' => 'message',
38            'presentation-model' => TwlEligiblePresentationModel::class,
39        ];
40
41        $icons['twl-eligible'] = [
42            'path' => 'TheWikipediaLibrary/modules/icons/twl-eligible.svg'
43        ];
44    }
45}