* @ingroup SpecialPage
*/
+use MediaWiki\MediaWikiServices;
+
/**
* A special page that allows users to change their preferences
*
$user = $this->getUser();
}
- $htmlForm = Preferences::getFormObject( $user, $this->getContext() );
- $htmlForm->setSubmitCallback( [ 'Preferences', 'tryUISubmit' ] );
+ $htmlForm = $this->getFormObject( $user, $this->getContext() );
$sectionTitles = $htmlForm->getPreferenceSections();
$prefTabs = '';
$htmlForm->show();
}
- private function showResetForm() {
+ /**
+ * Get the preferences form to use.
+ * @param User $user The user.
+ * @param IContextSource $context The context.
+ * @return PreferencesForm|HTMLForm
+ */
+ protected function getFormObject( $user, IContextSource $context ) {
+ $preferencesFactory = MediaWikiServices::getInstance()->getPreferencesFactory();
+ $form = $preferencesFactory->getForm( $user, $context );
+ return $form;
+ }
+
+ protected function showResetForm() {
if ( !$this->getUser()->isAllowed( 'editmyoptions' ) ) {
throw new PermissionsError( 'editmyoptions' );
}