MediaWiki  master
ResourceLoaderUserDefaultsModule.php
Go to the documentation of this file.
1 <?php
29  protected $targets = [ 'desktop', 'mobile' ];
30 
34  public function enableModuleContentVersion() {
35  return true;
36  }
37 
42  public function getScript( ResourceLoaderContext $context ) {
43  return 'mw.user.options.set('
44  . $context->encodeJson( User::getDefaultOptions() )
45  . ');';
46  }
47 }
ResourceLoaderContext
Context object that contains information about the state of a specific ResourceLoader web request.
Definition: ResourceLoaderContext.php:33
ResourceLoaderUserDefaultsModule\$targets
$targets
Definition: ResourceLoaderUserDefaultsModule.php:29
User\getDefaultOptions
static getDefaultOptions()
Combine the language default options with any site-specific options and add the default language vari...
Definition: User.php:1511
ResourceLoaderUserDefaultsModule
Module for default user preferences.
Definition: ResourceLoaderUserDefaultsModule.php:28
ResourceLoaderModule
Abstraction for ResourceLoader modules, with name registration and maxage functionality.
Definition: ResourceLoaderModule.php:39
ResourceLoaderUserDefaultsModule\enableModuleContentVersion
enableModuleContentVersion()
Definition: ResourceLoaderUserDefaultsModule.php:34
ResourceLoaderUserDefaultsModule\getScript
getScript(ResourceLoaderContext $context)
Definition: ResourceLoaderUserDefaultsModule.php:42
ResourceLoaderContext\encodeJson
encodeJson( $data)
Wrapper around json_encode that avoids needless escapes, and pretty-prints in debug mode.
Definition: ResourceLoaderContext.php:405