/** * @param {String} $key valid key as specified in validTabs * @return {HtmlForm} */ public function getPreferencesForm($key) { $prefs = array(); $user = $this->getUser(); $ctx = $this->getContext(); switch ($key) { case 'personal': Preferences::profilePreferences($user, $ctx, $prefs); break; case 'skin': Preferences::skinPreferences($user, $ctx, $prefs); break; case 'dateformat': Preferences::datetimePreferences($user, $ctx, $prefs); break; case 'files': Preferences::filesPreferences($user, $ctx, $prefs); break; case 'rc': Preferences::rcPreferences($user, $ctx, $prefs); break; } Preferences::loadPreferenceValues($user, $ctx, $prefs); $htmlForm = new PreferencesForm($prefs, $ctx, 'prefs'); $htmlForm->suppressReset(); $htmlForm->setModifiedUser($user); $htmlForm->setId('mw-prefs-form'); $htmlForm->setSubmitText($ctx->msg('saveprefs')->text()); $htmlForm->setSubmitCallback(array('Preferences', 'tryUISubmit')); $htmlForm->setAction(SpecialPage::getTitleFor($this->getName(), $key)->getLocalUrl()); return $htmlForm; }
static function getFormObject($user) { $formDescriptor = Preferences::getPreferences($user); $htmlForm = new PreferencesForm($formDescriptor, 'prefs'); $htmlForm->setSubmitText(wfMsg('saveprefs')); $htmlForm->setTitle(SpecialPage::getTitleFor('Preferences')); $htmlForm->setSubmitID('prefsubmit'); $htmlForm->setSubmitCallback(array('Preferences', 'tryFormSubmit')); return $htmlForm; }