20 private $themeStyles = [];
23 if ( isset( $options[
'themeScripts'] ) ) {
24 $skinScripts = $this->getSkinSpecific( $options[
'themeScripts'],
'scripts' );
25 $options[
'skinScripts'] = $this->extendSkinSpecific( $options[
'skinScripts'] ?? [],
$skinScripts );
27 if ( isset( $options[
'themeStyles'] ) ) {
28 $this->themeStyles = $this->getSkinSpecific( $options[
'themeStyles'],
'styles' );
31 parent::__construct( $options );
37 $this->skinStyles = $this->extendSkinSpecific( $this->skinStyles, $this->themeStyles );
48 private function getSkinSpecific( $module, $which ): array {
52 array_keys( $themes ),
53 array_map(
function ( $theme ) use ( $module, $which ) {
54 if ( $which ===
'scripts' ) {
59 }, array_values( $themes ) )
82 private function extendSkinSpecific( array $skinSpecific, array $themeSpecific ): array {
84 foreach ( $skinSpecific as $skin => &$files ) {
85 $prepend = $themeSpecific[$skin] ?? $themeSpecific[
'default'] ??
null;
86 if ( $prepend !==
null ) {
87 if ( !is_array( $files ) ) {
90 array_unshift( $files, $prepend );
94 foreach ( $themeSpecific as $skin => $file ) {
95 $skinSpecific[$skin] ??= [ $file ];