jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/371081 )

Change subject: Make it possible for subclasses to provide a different form
......................................................................


Make it possible for subclasses to provide a different form

This makes it possible for subclasses of SpecialPreferences to
specify a different HtmlForm to use for the preferences' form.

Bug: T68869
Change-Id: I9d6bbc6383a3d5b5c6839394de49ce9ca81efec9
---
M includes/specials/SpecialPreferences.php
1 file changed, 11 insertions(+), 1 deletion(-)

Approvals:
  jenkins-bot: Verified
  Jforrester: Looks good to me, approved



diff --git a/includes/specials/SpecialPreferences.php 
b/includes/specials/SpecialPreferences.php
index 40b50ea..ba5a57e 100644
--- a/includes/specials/SpecialPreferences.php
+++ b/includes/specials/SpecialPreferences.php
@@ -81,7 +81,7 @@
                        $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 @@
                $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' );

-- 
To view, visit https://gerrit.wikimedia.org/r/371081
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I9d6bbc6383a3d5b5c6839394de49ce9ca81efec9
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Samwilson <s...@samwilson.id.au>
Gerrit-Reviewer: Florianschmidtwelzow <florian.schmidt.stargatewis...@gmail.com>
Gerrit-Reviewer: Jforrester <jforres...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to