public static function onGetBetaFeaturePreferences( User $user, array &$betaPrefs ) { ... }Attach hook:
$wgHooks['GetBetaFeaturePreferences'][] = 'MyExtensionHooks::onGetBetaFeaturePreferences';Called from: File(s): BetaFeatures / includes/Hooks.php
For more information about attaching hooks, see Manual:Hooks .
For examples of other extensions using this hook, see Category:GetBetaFeaturePreferences extensions.
label-message
: (required) message key for the title of the featuredesc-message
: (required) message key for the description of the featurescreenshot
: (optional) either the path to an image representing the feature, either an array whose the keys are language codes or 'rtl' or 'ltr' for language-specific or language-direction-specific images; it can be used the global variable $wgExtensionAssetsPathrequirements
: (optional) array with keys:
betafeatures
: array of required preferences before activating this featureblacklist
: array of user agents blacklisted by this feature, this is only added in JavaScript variablesskins
: array of skins supported by the featureinfo-link
: (optional) URL pointing to the description of the featureinfo-message
: (optional) message key containing an URL pointing to the description of the featurediscussion-link
: (optional) URL pointing to a discussion page of the featurediscussion-message
: (optional) message key containing an URL pointing to the description of the featureauto-enrollment
: (optional) when this feature is enabled, enable other features whose the group
value is given by this auto-enrollment
valuegroup
: (optional) this feature can be enabled when the "parent" feature with a corresponding auto-enrollment
name is enableddependent
: (optional) if true, run for this feature the hook registered by the GetBetaFeatureDependencyHooks hookIn MyExtension/extension.json
:
"Hooks": { "GetBetaFeaturePreferences": "MediaWiki\\Extension\\MyExtension\\Hooks::onGetBetaFeaturePreferences" },
In MyExtension/includes/Hooks.php
:
namespace MediaWiki\Extension\MyExtension; class Hooks { static function onGetBetaFeaturePreferences( $user, &$prefs ) { $extensionAssetsPath = MediaWikiServices::getInstance() ->getMainConfig() ->get( 'ExtensionAssetsPath' ); $prefs['my-awesome-feature'] = array( // The first two are message keys 'label-message' => 'beta-feature-message', 'desc-message' => 'beta-feature-description', // Paths to images that represent the feature. 'screenshot' => [ 'ltr' => "$extensionAssetsPath/MyExtension/images/betafeature-ltr.png", 'rtl' => "$extensionAssetsPath/MyExtension/images/betafeature-rtl.png", ], // Link to information on the feature - use subpages on mw.org, maybe? 'info-link' => 'https://mediawiki.org/wiki/Special:MyLanguage/Help:Extension:MyExtension', // Link to discussion about the feature - talk pages might work 'discussion-link' => 'https://mediawiki.org/wiki/Special:MyLanguage/Help_talk:Extension:MyExtension', ); } }
// SpecialMyExtension.php class SpecialMyExtension extends SpecialPage { public function execute() { if ( BetaFeatures::isFeatureEnabled( $this->getUser(), 'my-awesome-feature' ) ) { // Implement the feature! } } }
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4