MediaWiki master
MediaWiki\User\Options\DefaultOptionsLookup Class Reference

A service class to control default user options. More...

Inherits MediaWiki\User\Options\UserOptionsLookup.

Collaboration diagram for MediaWiki\User\Options\DefaultOptionsLookup:

Public Member Functions

 __construct (ServiceOptions $options, Language $contentLang, HookContainer $hookContainer, NamespaceInfo $nsInfo, ConditionalDefaultsLookup $conditionalUserOptionsDefaultsLookup)
 
 getDefaultOptions (?UserIdentity $userIdentity=null)
 Combine the language default options with any site-specific and user-specific defaults and add the default language variants.
Parameters
UserIdentity | null$userIdentityUser to look the default up for; set to null to ignore any user-specific defaults (since 1.42)
Returns
array

 
 getOption (UserIdentity $user, string $oname, $defaultOverride=null, bool $ignoreHidden=false, int $queryFlags=IDBAccessObject::READ_NORMAL)
 Get the user's current setting for a given option.
Parameters
UserIdentity$userThe user to get the option for
string$onameThe option to check
mixed | null$defaultOverrideA default value returned if the option does not exist
bool$ignoreHiddenWhether to ignore the effects of $wgHiddenPrefs
int$queryFlagsA bit field composed of READ_XXX flags
Returns
mixed|null User's current value for the option, Note that while option values retrieved from the database are always strings, default values and values set within the current request and not yet saved may be of another type.
See also
getBoolOption()
getIntOption()

 
 getOptions (UserIdentity $user, int $flags=0, int $queryFlags=IDBAccessObject::READ_NORMAL)
 Get all user's options.
Parameters
UserIdentity$userThe user to get the option for
int$flagsBitwise combination of: UserOptionsManager::EXCLUDE_DEFAULTS Exclude user options that are set to the default value. Options that are set to their conditionally default value are not excluded.
int$queryFlagsA bit field composed of READ_XXX flags
Returns
array

 
- Public Member Functions inherited from MediaWiki\User\Options\UserOptionsLookup
 getBoolOption (UserIdentity $user, string $oname, int $queryFlags=IDBAccessObject::READ_NORMAL)
 Get the user's current setting for a given option, as a boolean value.
 
 getDefaultOption (string $opt, ?UserIdentity $userIdentity=null)
 Get a given default option value.
 
 getIntOption (UserIdentity $user, string $oname, int $defaultOverride=0, int $queryFlags=IDBAccessObject::READ_NORMAL)
 Get the user's current setting for a given option, as an integer value.
 

Public Attributes

const CONSTRUCTOR_OPTIONS
 
- Public Attributes inherited from MediaWiki\User\Options\UserOptionsLookup
const EXCLUDE_DEFAULTS = 1
 Exclude user options that are set to their default value.
 

Detailed Description

A service class to control default user options.

Since
1.35

Definition at line 39 of file DefaultOptionsLookup.php.

Constructor & Destructor Documentation

◆ __construct()

MediaWiki\User\Options\DefaultOptionsLookup::__construct ( ServiceOptions $options,
Language $contentLang,
HookContainer $hookContainer,
NamespaceInfo $nsInfo,
ConditionalDefaultsLookup $conditionalUserOptionsDefaultsLookup )
Parameters
ServiceOptions$options
Language$contentLang
HookContainer$hookContainer
NamespaceInfo$nsInfo
ConditionalDefaultsLookup$conditionalUserOptionsDefaultsLookup

Definition at line 67 of file DefaultOptionsLookup.php.

References MediaWiki\Config\ServiceOptions\assertRequiredOptions().

Member Function Documentation

◆ getDefaultOptions()

MediaWiki\User\Options\DefaultOptionsLookup::getDefaultOptions ( ?UserIdentity $userIdentity = null)

Combine the language default options with any site-specific and user-specific defaults and add the default language variants.

Parameters
UserIdentity | null$userIdentityUser to look the default up for; set to null to ignore any user-specific defaults (since 1.42)
Returns
array

Reimplemented from MediaWiki\User\Options\UserOptionsLookup.

Definition at line 125 of file DefaultOptionsLookup.php.

◆ getOption()

MediaWiki\User\Options\DefaultOptionsLookup::getOption ( UserIdentity $user,
string $oname,
$defaultOverride = null,
bool $ignoreHidden = false,
int $queryFlags = IDBAccessObject::READ_NORMAL )

Get the user's current setting for a given option.

Parameters
UserIdentity$userThe user to get the option for
string$onameThe option to check
mixed | null$defaultOverrideA default value returned if the option does not exist
bool$ignoreHiddenWhether to ignore the effects of $wgHiddenPrefs
int$queryFlagsA bit field composed of READ_XXX flags
Returns
mixed|null User's current value for the option, Note that while option values retrieved from the database are always strings, default values and values set within the current request and not yet saved may be of another type.
See also
getBoolOption()
getIntOption()

Reimplemented from MediaWiki\User\Options\UserOptionsLookup.

Definition at line 147 of file DefaultOptionsLookup.php.

◆ getOptions()

MediaWiki\User\Options\DefaultOptionsLookup::getOptions ( UserIdentity $user,
int $flags = 0,
int $queryFlags = IDBAccessObject::READ_NORMAL )

Get all user's options.

Parameters
UserIdentity$userThe user to get the option for
int$flagsBitwise combination of: UserOptionsManager::EXCLUDE_DEFAULTS Exclude user options that are set to the default value. Options that are set to their conditionally default value are not excluded.
int$queryFlagsA bit field composed of READ_XXX flags
Returns
array

Reimplemented from MediaWiki\User\Options\UserOptionsLookup.

Definition at line 161 of file DefaultOptionsLookup.php.

Member Data Documentation

◆ CONSTRUCTOR_OPTIONS

const MediaWiki\User\Options\DefaultOptionsLookup::CONSTRUCTOR_OPTIONS
Initial value:
= [
]
const DefaultUserOptions
Name constant for the DefaultUserOptions setting, for use with Config::get()
const DefaultSkin
Name constant for the DefaultSkin setting, for use with Config::get()
const NamespacesToBeSearchedDefault
Name constant for the NamespacesToBeSearchedDefault setting, for use with Config::get()
Access: internal
For use by ServiceWiring

Definition at line 44 of file DefaultOptionsLookup.php.


The documentation for this class was generated from the following file: