MediaWiki REL1_37
DerivativeResourceLoaderContext Class Reference

A mutable version of ResourceLoaderContext. More...

Inheritance diagram for DerivativeResourceLoaderContext:
Collaboration diagram for DerivativeResourceLoaderContext:

Public Member Functions

 __construct (ResourceLoaderContext $context)
 
 getContentOverrideCallback ()
 Return the replaced-content mapping callback.
 
 getDebug ()
 
 getDirection ()
 
 getLanguage ()
 
 getModules ()
 
 getOnly ()
 
 getRaw ()
 
 getRequest ()
 
 getResourceLoader ()
 
 getSkin ()
 
 getUser ()
 
 getUserObj ()
 Get the possibly-cached User object for the specified username.
 
 getVersion ()
 
 setContentOverrideCallback ( $callback)
 
 setDebug (int $debug)
 
 setDirection (string $direction)
 
 setLanguage (string $language)
 
 setModules (array $modules)
 
 setOnly (?string $only)
 
 setRaw (bool $raw)
 
 setSkin (string $skin)
 
 setUser (?string $user)
 
 setVersion (?string $version)
 
- Public Member Functions inherited from ResourceLoaderContext
 __construct (ResourceLoader $resourceLoader, WebRequest $request)
 
 encodeJson ( $data)
 Wrapper around json_encode that avoids needless escapes, and pretty-prints in debug mode.
 
 getConfig ()
 
 getFormat ()
 
 getHash ()
 All factors that uniquely identify this request, except 'modules'.
 
 getImage ()
 
 getImageObj ()
 If this is a request for an image, get the ResourceLoaderImage object.
 
 getLogger ()
 
 getReqBase ()
 Get the request base parameters, omitting any defaults.
 
 getVariant ()
 
 msg ( $key,... $params)
 Get a Message object with context set.
 
 shouldIncludeMessages ()
 
 shouldIncludeScripts ()
 
 shouldIncludeStyles ()
 

Protected Attributes

 $contentOverrideCallback = self::INHERIT_VALUE
 
 $debug = self::INHERIT_VALUE
 
 $direction = self::INHERIT_VALUE
 
 $language = self::INHERIT_VALUE
 
int array $modules = self::INHERIT_VALUE
 
 $only = self::INHERIT_VALUE
 
 $raw = self::INHERIT_VALUE
 
 $skin = self::INHERIT_VALUE
 
 $user = self::INHERIT_VALUE
 
 $userObj = self::INHERIT_VALUE
 
 $version = self::INHERIT_VALUE
 
- Protected Attributes inherited from ResourceLoaderContext
int $debug
 
 $direction
 
 $format
 
 $hash
 
 $image
 
ResourceLoaderImage false $imageObj
 
 $language
 
 $logger
 
 $modules
 
 $only
 
 $raw
 
 $request
 
 $resourceLoader
 
 $skin
 
 $user
 
 $userObj
 
 $variant
 
 $version
 

Private Attributes

ResourceLoaderContext $context
 
const INHERIT_VALUE = -1
 

Additional Inherited Members

- Static Public Member Functions inherited from ResourceLoaderContext
static debugFromString (?string $debug)
 
static newDummyContext ()
 Return a dummy ResourceLoaderContext object suitable for passing into things that don't "really" need a context.
 
- Public Attributes inherited from ResourceLoaderContext
const DEBUG_LEGACY = 1
 
const DEBUG_OFF = 0
 
const DEFAULT_LANG = 'qqx'
 
const DEFAULT_SKIN = 'fallback'
 

Detailed Description

A mutable version of ResourceLoaderContext.

Allows changing specific properties of a context object, without changing the main one. Inspired by MediaWiki's DerivativeContext.

Since
1.24

Definition at line 33 of file DerivativeResourceLoaderContext.php.

Constructor & Destructor Documentation

◆ __construct()

DerivativeResourceLoaderContext::__construct ( ResourceLoaderContext  $context)

Definition at line 54 of file DerivativeResourceLoaderContext.php.

References $context.

Member Function Documentation

◆ getContentOverrideCallback()

DerivativeResourceLoaderContext::getContentOverrideCallback ( )

Return the replaced-content mapping callback.

When editing a page that's used to generate the scripts or styles of a ResourceLoaderWikiModule, a preview should use the to-be-saved version of the page rather than the current version in the database. A context supporting such previews should return a callback to return these mappings here.

Since
1.32
Returns
callable|null Signature is Content|null func( Title $t )

Reimplemented from ResourceLoaderContext.

Definition at line 208 of file DerivativeResourceLoaderContext.php.

◆ getDebug()

DerivativeResourceLoaderContext::getDebug ( )

Reimplemented from ResourceLoaderContext.

Definition at line 147 of file DerivativeResourceLoaderContext.php.

◆ getDirection()

DerivativeResourceLoaderContext::getDirection ( )

Reimplemented from ResourceLoaderContext.

Definition at line 87 of file DerivativeResourceLoaderContext.php.

◆ getLanguage()

DerivativeResourceLoaderContext::getLanguage ( )

Reimplemented from ResourceLoaderContext.

Definition at line 73 of file DerivativeResourceLoaderContext.php.

◆ getModules()

DerivativeResourceLoaderContext::getModules ( )

Reimplemented from ResourceLoaderContext.

Definition at line 58 of file DerivativeResourceLoaderContext.php.

◆ getOnly()

DerivativeResourceLoaderContext::getOnly ( )
Returns
string|null

Reimplemented from ResourceLoaderContext.

Definition at line 159 of file DerivativeResourceLoaderContext.php.

◆ getRaw()

DerivativeResourceLoaderContext::getRaw ( )

Reimplemented from ResourceLoaderContext.

Definition at line 189 of file DerivativeResourceLoaderContext.php.

◆ getRequest()

DerivativeResourceLoaderContext::getRequest ( )

Reimplemented from ResourceLoaderContext.

Definition at line 200 of file DerivativeResourceLoaderContext.php.

◆ getResourceLoader()

DerivativeResourceLoaderContext::getResourceLoader ( )

Reimplemented from ResourceLoaderContext.

Definition at line 204 of file DerivativeResourceLoaderContext.php.

◆ getSkin()

DerivativeResourceLoaderContext::getSkin ( )

Reimplemented from ResourceLoaderContext.

Definition at line 103 of file DerivativeResourceLoaderContext.php.

◆ getUser()

DerivativeResourceLoaderContext::getUser ( )
Returns
string|null

Reimplemented from ResourceLoaderContext.

Definition at line 115 of file DerivativeResourceLoaderContext.php.

◆ getUserObj()

DerivativeResourceLoaderContext::getUserObj ( )

Get the possibly-cached User object for the specified username.

Since
1.25
Returns
User

Reimplemented from ResourceLoaderContext.

Definition at line 122 of file DerivativeResourceLoaderContext.php.

◆ getVersion()

DerivativeResourceLoaderContext::getVersion ( )

◆ setContentOverrideCallback()

DerivativeResourceLoaderContext::setContentOverrideCallback (   $callback)
See also
self::getContentOverrideCallback
Since
1.32
Parameters
callable | null | int$callbackAs per self::getContentOverrideCallback, or self::INHERIT_VALUE

Definition at line 221 of file DerivativeResourceLoaderContext.php.

◆ setDebug()

DerivativeResourceLoaderContext::setDebug ( int  $debug)

Definition at line 154 of file DerivativeResourceLoaderContext.php.

References $debug.

◆ setDirection()

DerivativeResourceLoaderContext::setDirection ( string  $direction)

Definition at line 98 of file DerivativeResourceLoaderContext.php.

◆ setLanguage()

DerivativeResourceLoaderContext::setLanguage ( string  $language)

Definition at line 80 of file DerivativeResourceLoaderContext.php.

◆ setModules()

DerivativeResourceLoaderContext::setModules ( array  $modules)
Parameters
string[]$modules

Definition at line 69 of file DerivativeResourceLoaderContext.php.

References $modules.

◆ setOnly()

DerivativeResourceLoaderContext::setOnly ( ?string  $only)
Parameters
string | null$only

Definition at line 169 of file DerivativeResourceLoaderContext.php.

◆ setRaw()

DerivativeResourceLoaderContext::setRaw ( bool  $raw)

Definition at line 196 of file DerivativeResourceLoaderContext.php.

◆ setSkin()

DerivativeResourceLoaderContext::setSkin ( string  $skin)

Definition at line 110 of file DerivativeResourceLoaderContext.php.

◆ setUser()

DerivativeResourceLoaderContext::setUser ( ?string  $user)
Parameters
string | null$user

Definition at line 140 of file DerivativeResourceLoaderContext.php.

◆ setVersion()

DerivativeResourceLoaderContext::setVersion ( ?string  $version)
Parameters
string | null$version

Definition at line 184 of file DerivativeResourceLoaderContext.php.

Member Data Documentation

◆ $contentOverrideCallback

DerivativeResourceLoaderContext::$contentOverrideCallback = self::INHERIT_VALUE
protected

Definition at line 52 of file DerivativeResourceLoaderContext.php.

◆ $context

ResourceLoaderContext DerivativeResourceLoaderContext::$context
private

Definition at line 39 of file DerivativeResourceLoaderContext.php.

Referenced by __construct().

◆ $debug

DerivativeResourceLoaderContext::$debug = self::INHERIT_VALUE
protected

Definition at line 48 of file DerivativeResourceLoaderContext.php.

◆ $direction

DerivativeResourceLoaderContext::$direction = self::INHERIT_VALUE
protected

Definition at line 44 of file DerivativeResourceLoaderContext.php.

◆ $language

DerivativeResourceLoaderContext::$language = self::INHERIT_VALUE
protected

Definition at line 43 of file DerivativeResourceLoaderContext.php.

◆ $modules

int array DerivativeResourceLoaderContext::$modules = self::INHERIT_VALUE
protected

Definition at line 42 of file DerivativeResourceLoaderContext.php.

◆ $only

DerivativeResourceLoaderContext::$only = self::INHERIT_VALUE
protected

Definition at line 49 of file DerivativeResourceLoaderContext.php.

◆ $raw

DerivativeResourceLoaderContext::$raw = self::INHERIT_VALUE
protected

Definition at line 51 of file DerivativeResourceLoaderContext.php.

◆ $skin

DerivativeResourceLoaderContext::$skin = self::INHERIT_VALUE
protected

Definition at line 45 of file DerivativeResourceLoaderContext.php.

◆ $user

DerivativeResourceLoaderContext::$user = self::INHERIT_VALUE
protected

Definition at line 46 of file DerivativeResourceLoaderContext.php.

◆ $userObj

DerivativeResourceLoaderContext::$userObj = self::INHERIT_VALUE
protected

Definition at line 47 of file DerivativeResourceLoaderContext.php.

◆ $version

DerivativeResourceLoaderContext::$version = self::INHERIT_VALUE
protected

Definition at line 50 of file DerivativeResourceLoaderContext.php.

◆ INHERIT_VALUE

const DerivativeResourceLoaderContext::INHERIT_VALUE = -1
private

Definition at line 34 of file DerivativeResourceLoaderContext.php.


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