Merge "Move section ID fallbacks into headers themselves"
[lhc/web/wiklou.git] / includes / specials / SpecialPreferences.php
index eee5b64..ba5a57e 100644 (file)
@@ -81,7 +81,7 @@ class SpecialPreferences extends SpecialPage {
                        $user = $this->getUser();
                }
 
-               $htmlForm = Preferences::getFormObject( $user, $this->getContext() );
+               $htmlForm = $this->getFormObject( $user, $this->getContext() );
                $htmlForm->setSubmitCallback( [ 'Preferences', 'tryUISubmit' ] );
                $sectionTitles = $htmlForm->getPreferenceSections();
 
@@ -117,6 +117,16 @@ class SpecialPreferences extends SpecialPage {
                $htmlForm->show();
        }
 
+       /**
+        * 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 ) {
+               return Preferences::getFormObject( $user, $context );
+       }
+
        private function showResetForm() {
                if ( !$this->getUser()->isAllowed( 'editmyoptions' ) ) {
                        throw new PermissionsError( 'editmyoptions' );
@@ -148,7 +158,7 @@ class SpecialPreferences extends SpecialPage {
                // Set session data for the success message
                $this->getRequest()->getSession()->set( 'specialPreferencesSaveSuccess', 1 );
 
-               $url = $this->getPageTitle()->getFullURL();
+               $url = $this->getPageTitle()->getFullUrlForRedirect();
                $this->getOutput()->redirect( $url );
 
                return true;