use Parser;
use ParserOptions;
use PreferencesForm;
+use Psr\Log\LoggerAwareTrait;
+use Psr\Log\NullLogger;
use Skin;
use SpecialPage;
use Status;
* This is the default implementation of PreferencesFactory.
*/
class DefaultPreferencesFactory implements PreferencesFactory {
+ use LoggerAwareTrait;
/** @var Config */
protected $config;
$this->contLang = $contLang;
$this->authManager = $authManager;
$this->linkRenderer = $linkRenderer;
+ $this->logger = new NullLogger();
}
/**
Hooks::run( 'GetPreferences', [ $user, &$preferences ] );
$this->loadPreferenceValues( $user, $context, $preferences );
+ $this->logger->debug( "Created form descriptor for user '{$user->getName()}'" );
return $preferences;
}
// Handling for multiselect preferences
if ( ( isset( $info['type'] ) && $info['type'] == 'multiselect' ) ||
- ( isset( $info['class'] ) && $info['class'] == 'HTMLMultiSelectField' ) ) {
+ ( isset( $info['class'] ) && $info['class'] == \HTMLMultiSelectField::class ) ) {
$options = HTMLFormField::flattenOptions( $info['options'] );
$prefix = isset( $info['prefix'] ) ? $info['prefix'] : $name;
$val = [];
// Handling for checkmatrix preferences
if ( ( isset( $info['type'] ) && $info['type'] == 'checkmatrix' ) ||
- ( isset( $info['class'] ) && $info['class'] == 'HTMLCheckMatrix' ) ) {
+ ( isset( $info['class'] ) && $info['class'] == \HTMLCheckMatrix::class ) ) {
$columns = HTMLFormField::flattenOptions( $info['columns'] );
$rows = HTMLFormField::flattenOptions( $info['rows'] );
$prefix = isset( $info['prefix'] ) ? $info['prefix'] : $name;
'type' => 'info',
'raw' => true,
'default' => $context->getLanguage()->pipeList( $linkTools ),
- 'label-message' => 'prefs-common-css-js',
+ 'label-message' => 'prefs-common-config',
'section' => 'rendering/skin',
];
}
}
$defaultPreferences['timecorrection'] = [
- 'class' => 'HTMLSelectOrOtherField',
+ 'class' => \HTMLSelectOrOtherField::class,
'label-message' => 'timezonelegend',
'options' => $tzOptions,
'default' => $tzSetting,
'section' => 'watchlist/advancedwatchlist',
'label-message' => 'tog-watchlisthideliu',
];
- $defaultPreferences['watchlistreloadautomatically'] = [
- 'type' => 'toggle',
- 'section' => 'watchlist/advancedwatchlist',
- 'label-message' => 'tog-watchlistreloadautomatically',
- ];
+
+ if ( !\SpecialWatchlist::checkStructuredFilterUiEnabled(
+ $this->config,
+ $user
+ ) ) {
+ $defaultPreferences['watchlistreloadautomatically'] = [
+ 'type' => 'toggle',
+ 'section' => 'watchlist/advancedwatchlist',
+ 'label-message' => 'tog-watchlistreloadautomatically',
+ ];
+ }
+
$defaultPreferences['watchlistunwatchlinks'] = [
'type' => 'toggle',
'section' => 'watchlist/advancedwatchlist',
public function getForm(
User $user,
IContextSource $context,
- $formClass = 'PreferencesForm',
+ $formClass = PreferencesForm::class,
array $remove = []
) {
$formDescriptor = $this->getFormDescriptor( $user, $context );
* @param PreferencesForm $form
* @return bool|Status|string
*/
- protected function legacySaveFormData( $formData, PreferencesForm $form ) {
+ public function legacySaveFormData( $formData, PreferencesForm $form ) {
return $this->saveFormData( $formData, $form );
}