MediaWiki fundraising/REL1_35
ResourceLoaderOOUIModule.php File Reference

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. More...

Go to the source code of this file.

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 $builtinSkinThemeMap
 
static $builtinThemePaths
 
static $knownImagesModules
 
static $knownStylesModules = [ 'core', 'widgets', 'toolbars', 'windows' ]
 
trait ResourceLoaderOOUIModule
 Convenience methods for dealing with OOUI themes and their relations to MW skins.
 

Detailed Description

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. http://www.gnu.org/copyleft/gpl.html

Definition in file ResourceLoaderOOUIModule.php.

Function Documentation

◆ getSkinThemeMap()

static 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 76 of file ResourceLoaderOOUIModule.php.

References $builtinSkinThemeMap.

Referenced by ResourceLoaderOOUIImageModule\loadFromDefinition().

◆ getThemeImagesPath()

getThemeImagesPath ( $theme,
$module )
protected
Parameters
string$themeSee getThemePath()
string$moduleSee getThemePath()
Returns
string|ResourceLoaderFilePath

Definition at line 170 of file ResourceLoaderOOUIModule.php.

References getThemePath().

Referenced by ResourceLoaderOOUIImageModule\loadOOUIDefinition(), and ResourceLoaderOOUIIconPackModule\loadOOUIDefinition().

◆ getThemePath()

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|ResourceLoaderFilePath

Definition at line 126 of file ResourceLoaderOOUIModule.php.

References $path, and getThemePaths().

Referenced by getThemeImagesPath(), getThemeScriptsPath(), and getThemeStylesPath().

◆ getThemePaths()

static 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 ResourceLoaderFilePaths.

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

Returns
array

Definition at line 92 of file ResourceLoaderOOUIModule.php.

References $builtinThemePaths, $path, and ResourceLoaderFileModule\extractBasePaths().

Referenced by getThemePath().

◆ getThemeScriptsPath()

getThemeScriptsPath ( $theme,
$module )
protected
Parameters
string$themeSee getThemePath()
string$moduleSee getThemePath()
Returns
string|ResourceLoaderFilePath

Definition at line 146 of file ResourceLoaderOOUIModule.php.

References getThemePath().

Referenced by ResourceLoaderOOUIFileModule\getSkinSpecific().

◆ getThemeStylesPath()

getThemeStylesPath ( $theme,
$module )
protected
Parameters
string$themeSee getThemePath()
string$moduleSee getThemePath()
Returns
string|ResourceLoaderFilePath

Definition at line 158 of file ResourceLoaderOOUIModule.php.

References getThemePath().

Referenced by ResourceLoaderOOUIFileModule\getSkinSpecific().

Variable Documentation

◆ $builtinSkinThemeMap

$builtinSkinThemeMap
staticprotected
Initial value:
= [
'default' => 'WikimediaUI',
]

Definition at line 52 of file ResourceLoaderOOUIModule.php.

Referenced by getSkinThemeMap().

◆ $builtinThemePaths

$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',
],
]

Definition at line 57 of file ResourceLoaderOOUIModule.php.

Referenced by getThemePaths().

◆ $knownImagesModules

$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 30 of file ResourceLoaderOOUIModule.php.

◆ $knownStylesModules

$knownStylesModules = [ 'core', 'widgets', 'toolbars', 'windows' ]
staticprotected

Definition at line 29 of file ResourceLoaderOOUIModule.php.