Merge "Fix variants for OO UI images"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Tue, 9 Jun 2015 23:02:11 +0000 (23:02 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Tue, 9 Jun 2015 23:02:11 +0000 (23:02 +0000)
includes/resourceloader/ResourceLoaderOOUIImageModule.php

index 6d76493..ebbeb01 100644 (file)
@@ -43,9 +43,16 @@ class ResourceLoaderOOUIImageModule extends ResourceLoaderImageModule {
 
                        if ( file_exists( $dataPath ) ) {
                                $data = json_decode( file_get_contents( $dataPath ), true );
-                               array_walk_recursive( $data['images'], function ( &$path ) use ( $rootPath, $theme ) {
+                               $fixPath = function ( &$path ) use ( $rootPath, $theme ) {
                                        // TODO Allow extensions to specify this path somehow
                                        $path = $rootPath . '/' . $theme . '/' . $path;
+                               };
+                               array_walk( $data['images'], function ( &$value ) use ( $fixPath ) {
+                                       if ( is_string( $value['file'] ) ) {
+                                               $fixPath( $value['file'] );
+                                       } else if ( is_array( $value['file'] ) ) {
+                                               array_walk_recursive( $value['file'], $fixPath );
+                                       }
                                } );
                        } else {
                                $data = array();