MediaWiki REL1_31
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 74 of file ResourceLoaderOOUIModule.php.

References $builtinSkinThemeMap, and ExtensionRegistry\getInstance().

Referenced by ResourceLoaderOOUIFileModule\getSkinSpecific(), and ResourceLoaderOOUIImageModule\loadFromDefinition().

◆ getThemeImagesPath()

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

Definition at line 140 of file ResourceLoaderOOUIModule.php.

References getThemePath().

Referenced by ResourceLoaderOOUIImageModule\loadFromDefinition().

◆ getThemePath()

getThemePath (   $theme,
  $kind,
  $module 
)
protected

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

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

Definition at line 104 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 string paths.

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

Returns
array

Definition at line 90 of file ResourceLoaderOOUIModule.php.

References $builtinThemePaths.

Referenced by getThemePath().

◆ getThemeScriptsPath()

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

Definition at line 116 of file ResourceLoaderOOUIModule.php.

References getThemePath().

Referenced by ResourceLoaderOOUIFileModule\getSkinSpecific().

◆ getThemeStylesPath()

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

Definition at line 128 of file ResourceLoaderOOUIModule.php.

References getThemePath().

Referenced by ResourceLoaderOOUIFileModule\getSkinSpecific().

Variable Documentation

◆ $builtinSkinThemeMap

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

Definition at line 50 of file ResourceLoaderOOUIModule.php.

Referenced by getSkinThemeMap().

◆ $builtinThemePaths

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

Definition at line 55 of file ResourceLoaderOOUIModule.php.

Referenced by getThemePaths().

◆ $knownImagesModules

$knownImagesModules
staticprotected
Initial value:
= [
'indicators', 'textures',
'icons-accessibility',
'icons-alerts',
'icons-content',
'icons-editing-advanced',
'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 29 of file ResourceLoaderOOUIModule.php.

◆ $knownStylesModules

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

Definition at line 28 of file ResourceLoaderOOUIModule.php.

◆ ResourceLoaderOOUIModule

trait ResourceLoaderOOUIModule
Initial value:
{
protected static $knownScriptsModules = [ 'core' ]

Convenience methods for dealing with OOUI themes and their relations to MW skins.

Since
1.30

Definition at line 26 of file ResourceLoaderOOUIModule.php.