Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
0.00% |
0 / 14 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
BetaFeaturesHandlers | |
0.00% |
0 / 14 |
|
0.00% |
0 / 2 |
12 | |
0.00% |
0 / 1 |
__construct | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
onGetBetaFeaturePreferences | |
0.00% |
0 / 13 |
|
0.00% |
0 / 1 |
6 |
1 | <?php |
2 | |
3 | namespace MediaWiki\Extension\Wikistories\Hooks; |
4 | |
5 | use MediaWiki\Config\Config; |
6 | use MediaWiki\Extension\BetaFeatures\Hooks\GetBetaFeaturePreferencesHook; |
7 | use MediaWiki\Extension\Wikistories\Hooks; |
8 | use MediaWiki\User\User; |
9 | |
10 | class BetaFeaturesHandlers implements GetBetaFeaturePreferencesHook { |
11 | |
12 | public const WIKISTORIES_BETA_FEATURE = 'wikistories-storiesonarticles'; |
13 | |
14 | /** @var Config */ |
15 | private $mainConfig; |
16 | |
17 | /** |
18 | * @param Config $mainConfig |
19 | */ |
20 | public function __construct( Config $mainConfig ) { |
21 | $this->mainConfig = $mainConfig; |
22 | } |
23 | |
24 | /** |
25 | * Allows overwriting of beta feature preferences |
26 | * |
27 | * @param User $user User the preferences are for |
28 | * @param array &$betaFeatures |
29 | * @return bool|void True or no return value to continue or false to abort |
30 | */ |
31 | public function onGetBetaFeaturePreferences( User $user, array &$betaFeatures ) { |
32 | if ( !Hooks::isBetaDiscoveryMode( $this->mainConfig ) ) { |
33 | return; |
34 | } |
35 | $extensionAssetsPath = $this->mainConfig->get( 'ExtensionAssetsPath' ); |
36 | $betaFeatures[ self::WIKISTORIES_BETA_FEATURE ] = [ |
37 | 'label-message' => 'wikistories-beta-feature-message', |
38 | 'desc-message' => 'wikistories-beta-feature-description', |
39 | 'screenshot' => [ |
40 | 'ltr' => "$extensionAssetsPath/Wikistories/resources/images/wikistories-betafeature-ltr.svg", |
41 | 'rtl' => "$extensionAssetsPath/Wikistories/resources/images/wikistories-betafeature-rtl.svg", |
42 | ], |
43 | 'info-link' => 'https://www.mediawiki.org/wiki/Wikistories', |
44 | 'discussion-link' => 'https://www.mediawiki.org/wiki/Talk:Wikistories', |
45 | ]; |
46 | } |
47 | } |