* @param string $selected Tag to select by default
* @param bool $ooui Use an OOUI TextInputWidget as selector instead of a non-OOUI input field
* You need to call OutputPage::enableOOUI() yourself.
+ * @param IContextSource|null $context
+ * @note Even though it takes null as a valid argument, an IContextSource is preferred
+ * in a new code, as the null value can change in the future
* @return array an array of (label, selector)
*/
- public static function buildTagFilterSelector( $selected = '', $ooui = false ) {
- global $wgUseTagFilter;
+ public static function buildTagFilterSelector(
+ $selected = '', $ooui = false, IContextSource $context = null
+ ) {
+ if ( !$context ) {
+ $context = RequestContext::getMain();
+ }
- if ( !$wgUseTagFilter || !count( self::listDefinedTags() ) ) {
+ $config = $context->getConfig();
+ if ( !$config->get( 'UseTagFilter' ) || !count( self::listDefinedTags() ) ) {
return [];
}
Html::rawElement(
'label',
[ 'for' => 'tagfilter' ],
- wfMessage( 'tag-filter' )->parse()
+ $context->msg( 'tag-filter' )->parse()
)
];
* @return HTMLForm
*/
protected function getAuthForm( array $requests, $action, $msg = '', $msgType = 'error' ) {
- global $wgSecureLogin, $wgLoginLanguageSelector;
+ global $wgSecureLogin;
// FIXME merge this with parent
if ( isset( $this->authForm ) ) {
$form = HTMLForm::factory( 'vform', $formDescriptor, $context );
$form->addHiddenField( 'authAction', $this->authAction );
- if ( $wgLoginLanguageSelector && $this->mLanguage ) {
+ if ( $this->mLanguage ) {
$form->addHiddenField( 'uselang', $this->mLanguage );
}
$form->addHiddenField( 'force', $this->securityLevel );
*/
protected function getFakeTemplate( $msg, $msgType ) {
global $wgAuth, $wgEnableEmail, $wgHiddenPrefs, $wgEmailConfirmToEdit, $wgEnableUserEmail,
- $wgSecureLogin, $wgLoginLanguageSelector, $wgPasswordResetRoutes;
+ $wgSecureLogin, $wgPasswordResetRoutes;
// make a best effort to get the value of fields which used to be fixed in the old login
// template but now might or might not exist depending on what providers are used
# Don't show a "create account" link if the user can't.
if ( $this->showCreateAccountLink() ) {
# Pass any language selection on to the mode switch link
- if ( $wgLoginLanguageSelector && $this->mLanguage ) {
+ if ( $this->mLanguage ) {
$linkq .= '&uselang=' . $this->mLanguage;
}
// Supply URL, login template creates the button.
* @return array
*/
protected function getFieldDefinitions( $template ) {
- global $wgEmailConfirmToEdit, $wgLoginLanguageSelector;
+ global $wgEmailConfirmToEdit;
$isLoggedIn = $this->getUser()->isLoggedIn();
$continuePart = $this->isContinued() ? 'continue-' : '';
$linkTitle = $this->getTitleFor( $this->isSignup() ? 'Userlogin' :'CreateAccount' );
$linkq = $this->getReturnToQueryStringFragment();
// Pass any language selection on to the mode switch link
- if ( $wgLoginLanguageSelector && $this->mLanguage ) {
+ if ( $this->mLanguage ) {
$linkq .= '&uselang=' . $this->mLanguage;
}
$loggedIn = $this->getUser()->isLoggedIn();