28 protected static $knownScriptsModules = [
'core' ];
33 'icons-accessibility',
36 'icons-editing-advanced',
37 'icons-editing-citation',
40 'icons-editing-styling',
53 'default' =>
'WikimediaUI',
59 'scripts' =>
'resources/lib/ooui/oojs-ui-wikimediaui.js',
60 'styles' =>
'resources/lib/ooui/oojs-ui-{module}-wikimediaui.css',
61 'images' =>
'resources/lib/ooui/themes/wikimediaui/{module}.json',
64 'scripts' =>
'resources/lib/ooui/oojs-ui-apex.js',
65 'styles' =>
'resources/lib/ooui/oojs-ui-{module}-apex.css',
66 'images' =>
'resources/lib/ooui/themes/apex/{module}.json',
78 $themeMap += ExtensionRegistry::getInstance()->getAttribute(
'SkinOOUIThemes' );
94 $themePaths += ExtensionRegistry::getInstance()->getAttribute(
'OOUIThemePaths' );
96 list( $defaultLocalBasePath, $defaultRemoteBasePath ) =
101 foreach ( $themePaths as $theme => &$paths ) {
102 list( $localBasePath, $remoteBasePath ) =
104 if ( $localBasePath !== $defaultLocalBasePath || $remoteBasePath !== $defaultRemoteBasePath ) {
105 foreach ( $paths as &
$path ) {
128 $path = $paths[$theme][$kind];
131 str_replace(
'{module}', $module,
$path->getPath() ),
132 $path->getLocalBasePath(),
133 $path->getRemoteBasePath()
136 $path = str_replace(
'{module}', $module,
$path );
147 if ( !in_array( $module, self::$knownScriptsModules ) ) {
148 throw new InvalidArgumentException(
"Invalid OOUI scripts module '$module'" );
150 return $this->
getThemePath( $theme,
'scripts', $module );
159 if ( !in_array( $module, self::$knownStylesModules ) ) {
160 throw new InvalidArgumentException(
"Invalid OOUI styles module '$module'" );
162 return $this->
getThemePath( $theme,
'styles', $module );
171 if ( !in_array( $module, self::$knownImagesModules ) ) {
172 throw new InvalidArgumentException(
"Invalid OOUI images module '$module'" );
174 return $this->
getThemePath( $theme,
'images', $module );
static $knownImagesModules
static getThemePaths()
Return a map of theme names to lists of paths from which a given theme should be loaded.
static $knownStylesModules
static $builtinSkinThemeMap
static $builtinThemePaths
getThemePath( $theme, $kind, $module)
Return a path to load given module of given theme from.
static getSkinThemeMap()
Return a map of skin names (in lowercase) to OOUI theme names, defining which theme a given skin shou...
getThemeScriptsPath( $theme, $module)
getThemeStylesPath( $theme, $module)
getThemeImagesPath( $theme, $module)
static extractBasePaths(array $options=[], $localBasePath=null, $remoteBasePath=null)
Extract a pair of local and remote base paths from module definition information.
An object to represent a path to a JavaScript/CSS file, along with a remote and local base path,...
trait ResourceLoaderOOUIModule
Convenience methods for dealing with OOUI themes and their relations to MW skins.