use OutputPage;
use Parser;
use ParserOptions;
-use PreferencesForm;
-use PreferencesFormOOUI;
+use PreferencesFormLegacy;
use Psr\Log\LoggerAwareTrait;
use Psr\Log\NullLogger;
use Skin;
$languageCode = $this->config->get( 'LanguageCode' );
if ( !array_key_exists( $languageCode, $languages ) ) {
$languages[$languageCode] = $languageCode;
+ // Sort the array again
+ ksort( $languages );
}
- ksort( $languages );
$options = [];
foreach ( $languages as $code => $name ) {
* @param IContextSource $context
* @param string $formClass
* @param array $remove Array of items to remove
- * @return PreferencesForm
+ * @return HTMLForm
*/
public function getForm(
User $user,
IContextSource $context,
- $formClass = PreferencesFormOOUI::class,
+ $formClass = PreferencesFormLegacy::class,
array $remove = []
) {
if ( SpecialPreferences::isOouiEnabled( $context ) ) {
}
/**
- * @var $htmlForm PreferencesForm
+ * @var $htmlForm HTMLForm
*/
$htmlForm = new $formClass( $formDescriptor, $context, 'prefs' );
# Used message keys: 'accesskey-preferences-save', 'tooltip-preferences-save'
$htmlForm->setSubmitTooltip( 'preferences-save' );
$htmlForm->setSubmitID( 'prefcontrol' );
- $htmlForm->setSubmitCallback( function ( array $formData, PreferencesForm $form ) {
+ $htmlForm->setSubmitCallback( function ( array $formData, HTMLForm $form ) {
return $this->submitForm( $formData, $form );
} );
* Handle the form submission if everything validated properly
*
* @param array $formData
- * @param PreferencesForm $form
+ * @param HTMLForm $form
* @return bool|Status|string
*/
- protected function saveFormData( $formData, PreferencesForm $form ) {
+ protected function saveFormData( $formData, HTMLForm $form ) {
$user = $form->getModifiedUser();
$hiddenPrefs = $this->config->get( 'HiddenPrefs' );
$result = true;
* @deprecated since 1.31, its inception
*
* @param array $formData
- * @param PreferencesForm $form
+ * @param HTMLForm $form
* @return bool|Status|string
*/
- public function legacySaveFormData( $formData, PreferencesForm $form ) {
+ public function legacySaveFormData( $formData, HTMLForm $form ) {
return $this->saveFormData( $formData, $form );
}
* Save the form data and reload the page
*
* @param array $formData
- * @param PreferencesForm $form
+ * @param HTMLForm $form
* @return Status
*/
- protected function submitForm( array $formData, PreferencesForm $form ) {
+ protected function submitForm( array $formData, HTMLForm $form ) {
$res = $this->saveFormData( $formData, $form );
- if ( $res ) {
+ if ( $res === true ) {
$context = $form->getContext();
-
$urlOptions = [];
if ( $res === 'eauth' ) {
$context->getOutput()->redirect( $url );
}
- return Status::newGood();
+ return ( $res === true ? Status::newGood() : $res );
}
/**
* @deprecated since 1.31, its inception
*
* @param array $formData
- * @param PreferencesForm $form
+ * @param HTMLForm $form
* @return Status
*/
- public function legacySubmitForm( array $formData, PreferencesForm $form ) {
+ public function legacySubmitForm( array $formData, HTMLForm $form ) {
return $this->submitForm( $formData, $form );
}