24use InvalidArgumentException;
33 protected static $knownScriptsModules = [
'core' ];
38 'icons-accessibility',
41 'icons-editing-advanced',
42 'icons-editing-citation',
45 'icons-editing-styling',
58 'default' =>
'WikimediaUI',
64 'scripts' =>
'resources/lib/ooui/oojs-ui-wikimediaui.js',
65 'styles' =>
'resources/lib/ooui/oojs-ui-{module}-wikimediaui.css',
66 'images' =>
'resources/lib/ooui/themes/wikimediaui/{module}.json',
69 'scripts' =>
'resources/lib/ooui/oojs-ui-apex.js',
70 'styles' =>
'resources/lib/ooui/oojs-ui-{module}-apex.css',
71 'images' =>
'resources/lib/ooui/themes/apex/{module}.json',
83 $themeMap += ExtensionRegistry::getInstance()->getAttribute(
'SkinOOUIThemes' );
99 $themePaths += ExtensionRegistry::getInstance()->getAttribute(
'OOUIThemePaths' );
101 [ $defaultLocalBasePath, $defaultRemoteBasePath ] =
106 foreach ( $themePaths as &$paths ) {
107 [ $localBasePath, $remoteBasePath ] =
109 if ( $localBasePath !== $defaultLocalBasePath || $remoteBasePath !== $defaultRemoteBasePath ) {
110 foreach ( $paths as &
$path ) {
133 $path = $paths[$theme][$kind];
136 str_replace(
'{module}', $module,
$path->getPath() ),
137 $path->getLocalBasePath(),
138 $path->getRemoteBasePath()
141 $path = str_replace(
'{module}', $module,
$path );
152 if ( !in_array( $module, self::$knownScriptsModules ) ) {
153 throw new InvalidArgumentException(
"Invalid OOUI scripts module '$module'" );
155 return $this->
getThemePath( $theme,
'scripts', $module );
164 if ( !in_array( $module, self::$knownStylesModules ) ) {
165 throw new InvalidArgumentException(
"Invalid OOUI styles module '$module'" );
167 return $this->
getThemePath( $theme,
'styles', $module );
176 if ( !in_array( $module, self::$knownImagesModules ) ) {
177 throw new InvalidArgumentException(
"Invalid OOUI images module '$module'" );
179 return $this->
getThemePath( $theme,
'images', $module );
184class_alias( OOUIModule::class,
'ResourceLoaderOOUIModule' );
The Registry loads JSON files, and uses a Processor to extract information from them.
trait OOUIModule
Convenience methods for dealing with OOUI themes and their relations to MW skins.