MobileFrontend
Mobile optimised frontend for MediaWiki
Loading...
Searching...
No Matches
MobileFrontend\Amc\UserMode Class Reference
+ Inheritance diagram for MobileFrontend\Amc\UserMode:
+ Collaboration diagram for MobileFrontend\Amc\UserMode:

Public Member Functions

 __construct (Manager $amcManager, UserIdentity $userIdentity, UserOptionsLookup $userOptionsLookup, UserOptionsManager $userOptionsManager)
 
 getModeIdentifier ()
 
 isEnabled ()
 Return information if the AMC mode is enabled by user.
 
 setEnabled (bool $isEnabled)
 Set Advanced Mobile Contributions mode to enabled or disabled.
 

Static Public Member Functions

static newForUser (UserIdentity $userIdentity)
 Create UserMode for given user NamedConstructor used by hooks system.
 

Public Attributes

const USER_OPTION_MODE_AMC = 'mf_amc_optin'
 
const OPTION_ENABLED = '1'
 Value in the user options when AMC is enabled.
 
const OPTION_DISABLED = '0'
 Value in the user options when AMC is disabled (default state)
 

Constructor & Destructor Documentation

◆ __construct()

MobileFrontend\Amc\UserMode::__construct ( Manager $amcManager,
UserIdentity $userIdentity,
UserOptionsLookup $userOptionsLookup,
UserOptionsManager $userOptionsManager )
Parameters
Manager$amcManager
UserIdentity$userIdentity
UserOptionsLookup$userOptionsLookup
UserOptionsManager$userOptionsManager
Exceptions

RuntimeException When AMC mode is not available

Member Function Documentation

◆ getModeIdentifier()

MobileFrontend\Amc\UserMode::getModeIdentifier ( )
Returns
string

Implements MobileFrontend\Features\IUserMode.

◆ isEnabled()

MobileFrontend\Amc\UserMode::isEnabled ( )

Return information if the AMC mode is enabled by user.

Returns
bool

Implements MobileFrontend\Features\IUserMode.

◆ newForUser()

static MobileFrontend\Amc\UserMode::newForUser ( UserIdentity $userIdentity)
static

Create UserMode for given user NamedConstructor used by hooks system.

Parameters
UserIdentity$userIdentity
Returns
self

◆ setEnabled()

MobileFrontend\Amc\UserMode::setEnabled ( bool $isEnabled)

Set Advanced Mobile Contributions mode to enabled or disabled.

WARNING: Does not persist the updated user preference to the database. The caller must handle this by calling User::saveSettings() after all preference updates associated with this web request are made.

Parameters
bool$isEnabled
Exceptions
RuntimeExceptionwhen mode is disabled

Implements MobileFrontend\Features\IUserSelectableMode.


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