function __construct() {
parent::__construct( 'Preferences' );
-
- $this->oouiEnabled = self::isOouiEnabled( $this->getContext() );
}
/**
* Check if OOUI mode is enabled, by config or query string
+ *
+ * @since 1.32
* @param IContextSource $context The context.
* @return bool
*/
}
public function execute( $par ) {
+ $this->oouiEnabled = static::isOouiEnabled( $this->getContext() );
+
$this->setHeaders();
$this->outputHeader();
$out = $this->getOutput();
if ( $this->oouiEnabled ) {
$out->addModules( 'mediawiki.special.preferences.ooui' );
$out->addModuleStyles( 'mediawiki.special.preferences.styles.ooui' );
+ $out->addModuleStyles( 'oojs-ui-widgets.styles' );
} else {
$out->addModules( 'mediawiki.special.preferences' );
$out->addModuleStyles( 'mediawiki.special.preferences.styles' );
];
}
$out->addJsConfigVars( 'wgPreferencesTabs', $prefTabs );
-
- // TODO: Render fake tabs here to avoid FOUC.
- // $out->addHTML( $fakeTabs );
} else {
$prefTabs = '';
* Get the preferences form to use.
* @param User $user The user.
* @param IContextSource $context The context.
- * @return PreferencesForm|HTMLForm
+ * @return PreferencesFormLegacy|HTMLForm
*/
protected function getFormObject( $user, IContextSource $context ) {
$preferencesFactory = MediaWikiServices::getInstance()->getPreferencesFactory();
$context = new DerivativeContext( $this->getContext() );
$context->setTitle( $this->getPageTitle( 'reset' ) ); // Reset subpage
- $htmlForm = HTMLForm::factory(
- $this->oouiEnabled ? 'ooui' : 'vform', [], $context, 'prefs-restore'
- );
+ $htmlForm = HTMLForm::factory( 'ooui', [], $context, 'prefs-restore' );
$htmlForm->setSubmitTextMsg( 'restoreprefs' );
$htmlForm->setSubmitDestructive();