* over to the tryUISubmit static method of this class.
*/
class Preferences {
- /** @var array */
- protected static $defaultPreferences = null;
-
/** @var array */
protected static $saveFilters = [
'timecorrection' => [ 'Preferences', 'filterTimezoneInput' ],
* @return array|null
*/
static function getPreferences( $user, IContextSource $context ) {
- if ( self::$defaultPreferences ) {
- return self::$defaultPreferences;
- }
-
OutputPage::setupOOUI(
strtolower( $context->getSkin()->getSkinName() ),
$context->getLanguage()->getDir()
Hooks::run( 'GetPreferences', [ $user, &$defaultPreferences ] );
self::loadPreferenceValues( $user, $context, $defaultPreferences );
- self::$defaultPreferences = $defaultPreferences;
return $defaultPreferences;
}
/** Helper */
protected function prefsFor( $user_key ) {
- // TODO This should use Preferences::getPreferences() instead of calling internal methods.
- // Unfortunately that currently ignores the $user parameter if it has cached data, even for
- // a different user...
- OutputPage::setupOOUI(
- strtolower( $this->context->getSkin()->getSkinName() ),
- $this->context->getLanguage()->getDir()
- );
- $preferences = [];
- Preferences::profilePreferences(
+ return Preferences::getPreferences(
$this->prefUsers[$user_key],
- $this->context,
- $preferences
+ $this->context
);
-
- return $preferences;
}
}