From: Sam Wilson Date: Thu, 10 Aug 2017 17:15:16 +0000 (-0400) Subject: Make it possible for subclasses to provide a different form X-Git-Tag: 1.31.0-rc.0~2421^2 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/exercices/modifier.php?a=commitdiff_plain;h=05a7239ab382a3f7db6df4a9c2382018fbbdeba3;p=lhc%2Fweb%2Fwiklou.git 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 --- diff --git a/includes/specials/SpecialPreferences.php b/includes/specials/SpecialPreferences.php index 40b50ea5bf..ba5a57ea5a 100644 --- a/includes/specials/SpecialPreferences.php +++ b/includes/specials/SpecialPreferences.php @@ -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' );