MediaWiki
REL1_34
ResourceLoaderUserOptionsModule.php
Go to the documentation of this file.
1
<?php
29
class
ResourceLoaderUserOptionsModule
extends
ResourceLoaderModule
{
30
31
protected
$origin
= self::ORIGIN_CORE_INDIVIDUAL;
32
33
protected
$targets
= [
'desktop'
,
'mobile'
];
34
39
public
function
getDependencies
(
ResourceLoaderContext
$context
=
null
) {
40
return
[
'user.defaults'
];
41
}
42
46
public
function
enableModuleContentVersion
() {
47
return
true
;
48
}
49
54
public
function
getScript
(
ResourceLoaderContext
$context
) {
55
// Use FILTER_NOMIN annotation to prevent needless minification and caching (T84960).
56
return
ResourceLoader::FILTER_NOMIN
57
.
'mw.user.options.set('
58
.
$context
->encodeJson(
59
$context
->getUserObj()->getOptions(
User::GETOPTIONS_EXCLUDE_DEFAULTS
)
60
)
61
.
');'
;
62
}
63
67
public
function
supportsURLLoading
() {
68
return
false
;
69
}
70
75
public
function
isKnownEmpty
(
ResourceLoaderContext
$context
) {
76
return
!
$context
->getUserObj()->getOptions(
User::GETOPTIONS_EXCLUDE_DEFAULTS
);
77
}
78
82
public
function
getGroup
() {
83
return
'private'
;
84
}
85
}
ResourceLoaderContext
Context object that contains information about the state of a specific ResourceLoader web request.
Definition
ResourceLoaderContext.php:33
ResourceLoaderModule
Abstraction for ResourceLoader modules, with name registration and maxage functionality.
Definition
ResourceLoaderModule.php:37
ResourceLoaderUserOptionsModule
Module for user preferences.
Definition
ResourceLoaderUserOptionsModule.php:29
ResourceLoaderUserOptionsModule\getDependencies
getDependencies(ResourceLoaderContext $context=null)
Definition
ResourceLoaderUserOptionsModule.php:39
ResourceLoaderUserOptionsModule\isKnownEmpty
isKnownEmpty(ResourceLoaderContext $context)
Definition
ResourceLoaderUserOptionsModule.php:75
ResourceLoaderUserOptionsModule\getScript
getScript(ResourceLoaderContext $context)
Definition
ResourceLoaderUserOptionsModule.php:54
ResourceLoaderUserOptionsModule\$origin
$origin
Definition
ResourceLoaderUserOptionsModule.php:31
ResourceLoaderUserOptionsModule\$targets
$targets
Definition
ResourceLoaderUserOptionsModule.php:33
ResourceLoaderUserOptionsModule\enableModuleContentVersion
enableModuleContentVersion()
Definition
ResourceLoaderUserOptionsModule.php:46
ResourceLoaderUserOptionsModule\getGroup
getGroup()
Definition
ResourceLoaderUserOptionsModule.php:82
ResourceLoaderUserOptionsModule\supportsURLLoading
supportsURLLoading()
Definition
ResourceLoaderUserOptionsModule.php:67
User\GETOPTIONS_EXCLUDE_DEFAULTS
const GETOPTIONS_EXCLUDE_DEFAULTS
Exclude user options that are set to their default value.
Definition
User.php:73
$context
$context
Definition
load.php:45
includes
resourceloader
ResourceLoaderUserOptionsModule.php
Generated on Fri Apr 5 2024 23:10:24 for MediaWiki by
1.9.8