Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 24
0.00% covered (danger)
0.00%
0 / 2
CRAP
0.00% covered (danger)
0.00%
0 / 1
Hooks
0.00% covered (danger)
0.00%
0 / 24
0.00% covered (danger)
0.00%
0 / 2
12
0.00% covered (danger)
0.00%
0 / 1
 onGetPreferences
0.00% covered (danger)
0.00%
0 / 12
0.00% covered (danger)
0.00%
0 / 1
6
 onBeforeCreateEchoEvent
0.00% covered (danger)
0.00%
0 / 12
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2/**
3 * Some hooks for TranslationNotifications extension.
4 *
5 * @file
6 * @author Amir E. Aharoni
7 * @author Santhosh Thottingal
8 * @copyright Copyright © 2012, Amir E. Aharoni
9 * @license GPL-2.0-or-later
10 */
11
12namespace MediaWiki\Extension\TranslationNotifications;
13
14use MediaWiki\Preferences\Hook\GetPreferencesHook;
15
16/**
17 * Some hooks for TranslationNotifications extension.
18 */
19class Hooks implements GetPreferencesHook {
20    /** @inheritDoc */
21    public function onGetPreferences( $user, &$preferences ) {
22        foreach (
23            [
24                'translationnotifications-lang-1',
25                'translationnotifications-lang-2',
26                'translationnotifications-lang-3',
27                'translationnotifications-cmethod-email',
28                'translationnotifications-cmethod-talkpage',
29                'translationnotifications-cmethod-talkpage-elsewhere-loc',
30                'translationnotifications-freq',
31            ] as $preference
32        ) {
33            $preferences[$preference] = [
34                'type' => 'api',
35            ];
36        }
37    }
38
39    /**
40     * Hook: BeforeCreateEchoEvent
41     * @param array[] &$notifications
42     * @param array[] &$notificationCategories
43     * @param array[] &$icons
44     */
45    public static function onBeforeCreateEchoEvent(
46        &$notifications,
47        &$notificationCategories,
48        &$icons
49    ) {
50        $notificationCategories[ 'translationnotifications' ] = [
51            'tooltip' => 'echo-pref-tooltip-inactive-unsubscribe',
52        ];
53
54        $notifications[ 'translationnotifications-unsubscribed' ] = [
55            'category' => 'translationnotifications',
56            'group' => 'neutral',
57            'section' => 'alert',
58            'presentation-model' => UnsubscribeInactiveUsersPresentationModel::class,
59            'user-locators' => [
60                [ UnsubscribeInactiveUsersPresentationModel::class . '::locateUsers' ]
61            ]
62        ];
63    }
64}