X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fapi%2FApiOptions.php;h=436f22aee5d285d2ffaa5e31103c6f12189615d1;hb=4e90d55fdc9d31d93e24cf05687eb7d180806f44;hp=c804563af3eec7287b495ab4c182cd8b27fc0d5a;hpb=30cc068774d9de3af900af70d00126f9be721773;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiOptions.php b/includes/api/ApiOptions.php index c804563af3..436f22aee5 100644 --- a/includes/api/ApiOptions.php +++ b/includes/api/ApiOptions.php @@ -75,11 +75,17 @@ class ApiOptions extends ApiBase { $prefs = Preferences::getPreferences( $user, $this->getContext() ); $prefsKinds = $user->getOptionKinds( $this->getContext(), $changes ); + $htmlForm = null; foreach ( $changes as $key => $value ) { switch ( $prefsKinds[$key] ) { case 'registered': // Regular option. + if ( $htmlForm === null ) { + // We need a dummy HTMLForm for the validate callback... + $htmlForm = new HTMLForm( array(), $this ); + } $field = HTMLForm::loadInputFromParameters( $key, $prefs[$key] ); + $field->mParent = $htmlForm; $validation = $field->validate( $value, $user->getOptions() ); break; case 'registered-multiselect': @@ -161,7 +167,7 @@ class ApiOptions extends ApiBase { return 'https://www.mediawiki.org/wiki/API:Options'; } - public function getExamplesMessages() { + protected function getExamplesMessages() { return array( 'action=options&reset=&token=123ABC' => 'apihelp-options-example-reset',