/** * @param string $modulePath * @param string $designPath * @param string $dir * @param string $file * * @return string */ private function resolveAssetPath($modulePath, $designPath, $dir, $file) { if ($this->designAssetsPath === null) { $this->designAssetsPath = $this->appPath->getDesignPathInternal(); } $assetPath = ''; $designAssetPath = $this->designAssetsPath . $designPath . $dir . $file; // A theme has overridden a static asset of a module if (is_file($designAssetPath) === true) { $assetPath = $designAssetPath; } else { $designInfo = $this->xml->parseXmlFile($this->designAssetsPath . '/info.xml', '/design'); // Recursively iterate over the nested themes if (!empty($designInfo['parent'])) { $this->designAssetsPath = $this->appPath->getDesignRootPathInternal() . $designInfo['parent'] . '/'; $assetPath = $this->getStaticAssetPath($modulePath, $designPath, $dir, $file); $this->designAssetsPath = $this->appPath->getDesignPathInternal(); return $assetPath; } // No overrides have been found -> iterate over all possible module namespaces foreach (array_reverse($this->vendors->getVendors()) as $vendor) { $moduleAssetPath = $this->appPath->getModulesDir() . $vendor . '/' . $modulePath . $dir . $file; if (is_file($moduleAssetPath) === true) { $assetPath = $moduleAssetPath; break; } } } $systemAssetPath = $this->appPath->getModulesDir() . $modulePath . $dir . $file; $this->cachedPaths[$systemAssetPath] = $assetPath; $this->newAssetPathsAdded = true; return $assetPath; }