MediaWiki master
MediaWiki\ResourceLoader Namespace Reference

Namespaces

namespace  Hook
 

Classes

class  CircularDependencyError
 
class  ClientHtml
 Load and configure a ResourceLoader client on an HTML page. More...
 
class  CodexModule
 Module for codex that has direction-specific style files and a static helper function for embedding icons in package modules. More...
 
class  Context
 Context object that contains information about the state of a specific ResourceLoader web request. More...
 
class  DerivativeContext
 A mutable version of Context. More...
 
class  FileModule
 Module based on local JavaScript/CSS files. More...
 
class  FilePath
 A path to a bundled file (such as JavaScript or CSS), along with a remote and local base path. More...
 
class  ForeignApiModule
 Module for mediawiki.ForeignApi and mediawiki.ForeignRest that has dynamically generated dependencies, via a hook usable by extensions. More...
 
class  ForeignResourceManager
 Manage foreign resources registered with ResourceLoader. More...
 
class  HookRunner
 
class  Image
 Class encapsulating an image used in an ImageModule. More...
 
class  ImageModule
 Module for generated and embedded images. More...
 
class  LessVarFileModule
 Module augmented with context-specific LESS variables. More...
 
class  MessageBlobStore
 This class generates message blobs for use by ResourceLoader. More...
 
class  Module
 Abstraction for ResourceLoader modules, with name registration and maxage functionality. More...
 
class  MwUrlModule
 
class  OOUIFileModule
 Module which magically loads the right skinScripts and skinStyles for every skin, using the specified OOUI theme for each. More...
 
class  OOUIIconPackModule
 Allows loading arbitrary sets of OOUI icons. More...
 
class  OOUIImageModule
 Loads the module definition from JSON files in the format that OOUI uses, converting it to the format we use. More...
 
class  ResourceLoader
 ResourceLoader is a loading system for JavaScript and CSS resources. More...
 
class  ResourceLoaderEntryPoint
 Entry point implementation for ResourceLoader, which serves static CSS/JavaScript via MediaWiki\ResourceLoader\Module Module subclasses. More...
 
class  SiteModule
 Module for site customizations. More...
 
class  SiteStylesModule
 Module for site style customizations. More...
 
class  SkinModule
 Module for skin stylesheets. More...
 
class  StartUpModule
 Module for ResourceLoader initialization. More...
 
class  UserModule
 Module for user customizations scripts. More...
 
class  UserOptionsModule
 Module for per-user private data that is transmitted on all HTML web responses. More...
 
class  UserStylesModule
 Module for user customizations styles. More...
 
class  VueComponentParser
 Parser for Vue single file components (.vue files). More...
 
class  WikiModule
 Abstraction for ResourceLoader modules which pull from wiki pages. More...
 

Functions

static getSkinThemeMap ()
 Return a map of skin names (in lowercase) to OOUI theme names, defining which theme a given skin should use.
 
 getThemeImagesPath ( $theme, $module)
 
 getThemePath ( $theme, $kind, $module)
 Return a path to load given module of given theme from.
 
static getThemePaths ()
 Return a map of theme names to lists of paths from which a given theme should be loaded.
 
 getThemeScriptsPath ( $theme, $module)
 
 getThemeStylesPath ( $theme, $module)
 

Variables

static string[] $builtinSkinThemeMap
 Note that keys must be lowercase, values TitleCase.
 
static string[][] $builtinThemePaths
 Note that keys must be TitleCase.
 
static $knownImagesModules
 
static $knownStylesModules = [ 'core', 'widgets', 'toolbars', 'windows' ]
 
trait OOUIModule
 Convenience methods for dealing with OOUI themes and their relations to MW skins.
 

Function Documentation

◆ getSkinThemeMap()

static MediaWiki\ResourceLoader\getSkinThemeMap ( )
static

Return a map of skin names (in lowercase) to OOUI theme names, defining which theme a given skin should use.

Returns
array

Definition at line 81 of file OOUIModule.php.

References MediaWiki\ResourceLoader\$builtinSkinThemeMap.

Referenced by MediaWiki\ResourceLoader\OOUIImageModule\loadFromDefinition().

◆ getThemeImagesPath()

MediaWiki\ResourceLoader\getThemeImagesPath ( $theme,
$module )
protected
Parameters
string$themeSee getThemePath()
string$moduleSee getThemePath()
Returns
string|FilePath

Definition at line 175 of file OOUIModule.php.

References MediaWiki\ResourceLoader\getThemePath().

Referenced by MediaWiki\ResourceLoader\OOUIImageModule\loadOOUIDefinition(), and MediaWiki\ResourceLoader\OOUIIconPackModule\loadOOUIDefinition().

◆ getThemePath()

MediaWiki\ResourceLoader\getThemePath ( $theme,
$kind,
$module )
protected

Return a path to load given module of given theme from.

The file at this path may not exist. This should be handled by the caller (throwing an error or falling back to default theme).

Parameters
string$themeOOUI theme name, for example 'WikimediaUI' or 'Apex'
string$kindKind of the module: 'scripts', 'styles', or 'images'
string$moduleModule name, for valid values see $knownScriptsModules, $knownStylesModules, $knownImagesModules
Returns
string|FilePath

Definition at line 131 of file OOUIModule.php.

References $path, and MediaWiki\ResourceLoader\getThemePaths().

Referenced by MediaWiki\ResourceLoader\getThemeImagesPath(), MediaWiki\ResourceLoader\getThemeScriptsPath(), and MediaWiki\ResourceLoader\getThemeStylesPath().

◆ getThemePaths()

static MediaWiki\ResourceLoader\getThemePaths ( )
staticprotected

Return a map of theme names to lists of paths from which a given theme should be loaded.

Keys are theme names, values are associative arrays. Keys of the inner array are 'scripts', 'styles', or 'images', and values are paths. Paths may be strings or FilePaths.

Additionally, the string '{module}' in paths represents the name of the module to load.

Returns
array

Definition at line 97 of file OOUIModule.php.

References MediaWiki\ResourceLoader\$builtinThemePaths, $path, and MediaWiki\ResourceLoader\FileModule\extractBasePaths().

Referenced by MediaWiki\ResourceLoader\getThemePath().

◆ getThemeScriptsPath()

MediaWiki\ResourceLoader\getThemeScriptsPath ( $theme,
$module )
protected
Parameters
string$themeSee getThemePath()
string$moduleSee getThemePath()
Returns
string|FilePath

Definition at line 151 of file OOUIModule.php.

References MediaWiki\ResourceLoader\getThemePath().

◆ getThemeStylesPath()

MediaWiki\ResourceLoader\getThemeStylesPath ( $theme,
$module )
protected
Parameters
string$themeSee getThemePath()
string$moduleSee getThemePath()
Returns
string|FilePath

Definition at line 163 of file OOUIModule.php.

References MediaWiki\ResourceLoader\getThemePath().

Variable Documentation

◆ $builtinSkinThemeMap

string [] MediaWiki::ResourceLoader\$builtinSkinThemeMap
staticprotected
Initial value:
= [
'default' => 'WikimediaUI',
]

Note that keys must be lowercase, values TitleCase.

Definition at line 57 of file OOUIModule.php.

Referenced by MediaWiki\ResourceLoader\getSkinThemeMap().

◆ $builtinThemePaths

string [][] MediaWiki::ResourceLoader\$builtinThemePaths
staticprotected
Initial value:
= [
'WikimediaUI' => [
'scripts' => 'resources/lib/ooui/oojs-ui-wikimediaui.js',
'styles' => 'resources/lib/ooui/oojs-ui-{module}-wikimediaui.css',
'images' => 'resources/lib/ooui/themes/wikimediaui/{module}.json',
],
'Apex' => [
'scripts' => 'resources/lib/ooui/oojs-ui-apex.js',
'styles' => 'resources/lib/ooui/oojs-ui-{module}-apex.css',
'images' => 'resources/lib/ooui/themes/apex/{module}.json',
],
]

Note that keys must be TitleCase.

Definition at line 62 of file OOUIModule.php.

Referenced by MediaWiki\ResourceLoader\getThemePaths().

◆ $knownImagesModules

MediaWiki::ResourceLoader\$knownImagesModules
staticprotected
Initial value:
= [
'indicators',
'icons-accessibility',
'icons-alerts',
'icons-content',
'icons-editing-advanced',
'icons-editing-citation',
'icons-editing-core',
'icons-editing-list',
'icons-editing-styling',
'icons-interactions',
'icons-layout',
'icons-location',
'icons-media',
'icons-moderation',
'icons-movement',
'icons-user',
'icons-wikimedia',
]

Definition at line 35 of file OOUIModule.php.

◆ $knownStylesModules

MediaWiki::ResourceLoader\$knownStylesModules = [ 'core', 'widgets', 'toolbars', 'windows' ]
staticprotected

Definition at line 34 of file OOUIModule.php.