34 private $themeStyles = [];
37 if ( isset( $options[
'themeScripts'] ) ) {
38 $skinScripts = $this->getSkinSpecific( $options[
'themeScripts'],
'scripts' );
39 $options[
'skinScripts'] = $this->extendSkinSpecific( $options[
'skinScripts'] ?? [],
$skinScripts );
41 if ( isset( $options[
'themeStyles'] ) ) {
42 $this->themeStyles = $this->getSkinSpecific( $options[
'themeStyles'],
'styles' );
45 parent::__construct( $options );
51 $this->skinStyles = $this->extendSkinSpecific( $this->skinStyles, $this->themeStyles );
62 private function getSkinSpecific( $module, $which ): array {
66 array_keys( $themes ),
67 array_map(
function ( $theme ) use ( $module, $which ) {
68 if ( $which ===
'scripts' ) {
73 }, array_values( $themes ) )
96 private function extendSkinSpecific( array $skinSpecific, array $themeSpecific ): array {
98 foreach ( $skinSpecific as $skin => $files ) {
99 if ( !is_array( $files ) ) {
102 if ( isset( $themeSpecific[$skin] ) ) {
103 $skinSpecific[$skin] = array_merge( [ $themeSpecific[$skin] ], $files );
104 } elseif ( isset( $themeSpecific[
'default'] ) ) {
105 $skinSpecific[$skin] = array_merge( [ $themeSpecific[
'default'] ], $files );
109 foreach ( $themeSpecific as $skin => $file ) {
110 if ( !isset( $skinSpecific[$skin] ) ) {
111 $skinSpecific[$skin] = [ $file ];
114 return $skinSpecific;