@@ -215,13 +215,13 @@ |
||
| 215 | 215 | if (!empty($tag)) { |
| 216 | 216 | $url = FileHelper::createUrl($this->serverPublic, $tag['url']); |
| 217 | 217 | switch ($tag['type']) { |
| 218 | - case 'import': |
|
| 219 | - $lines[] = HtmlHelper::tag('link', '', [ |
|
| 220 | - 'crossorigin' => $tag['crossorigin'], |
|
| 221 | - 'href' => $url, |
|
| 222 | - 'rel' => 'modulepreload', |
|
| 223 | - ]); |
|
| 224 | - break; |
|
| 218 | + case 'import': |
|
| 219 | + $lines[] = HtmlHelper::tag('link', '', [ |
|
| 220 | + 'crossorigin' => $tag['crossorigin'], |
|
| 221 | + 'href' => $url, |
|
| 222 | + 'rel' => 'modulepreload', |
|
| 223 | + ]); |
|
| 224 | + break; |
|
| 225 | 225 | case 'file': |
| 226 | 226 | $lines[] = HtmlHelper::jsFile($url, $tag['options']); |
| 227 | 227 | break; |
@@ -152,15 +152,15 @@ discard block |
||
| 152 | 152 | 'options' => $tagOptions |
| 153 | 153 | ]; |
| 154 | 154 | // Include any imports |
| 155 | - $importFiles = []; |
|
| 156 | - self::extractImportFiles(self::$manifest, $manifestKey, $importFiles); |
|
| 157 | - foreach ($importFiles as $importFile) { |
|
| 158 | - $tags[] = [ |
|
| 159 | - 'crossorigin' => $tagOptions['crossorigin'] ?? true, |
|
| 160 | - 'type' => 'import', |
|
| 161 | - 'url' => $importFile, |
|
| 162 | - ]; |
|
| 163 | - } |
|
| 155 | + $importFiles = []; |
|
| 156 | + self::extractImportFiles(self::$manifest, $manifestKey, $importFiles); |
|
| 157 | + foreach ($importFiles as $importFile) { |
|
| 158 | + $tags[] = [ |
|
| 159 | + 'crossorigin' => $tagOptions['crossorigin'] ?? true, |
|
| 160 | + 'type' => 'import', |
|
| 161 | + 'url' => $importFile, |
|
| 162 | + ]; |
|
| 163 | + } |
|
| 164 | 164 | // Include any CSS tags |
| 165 | 165 | $cssFiles = []; |
| 166 | 166 | self::extractCssFiles(self::$manifest, $manifestKey, $cssFiles); |
@@ -178,32 +178,32 @@ discard block |
||
| 178 | 178 | return $tags; |
| 179 | 179 | } |
| 180 | 180 | |
| 181 | - /** |
|
| 182 | - * Extract any import files from entries recursively |
|
| 183 | - * |
|
| 184 | - * @param array $manifest |
|
| 185 | - * @param string $manifestKey |
|
| 186 | - * @param array $importFiles |
|
| 187 | - * |
|
| 188 | - * @return array |
|
| 189 | - */ |
|
| 190 | - protected static function extractImportFiles(array $manifest, string $manifestKey, array &$importFiles): array |
|
| 191 | - { |
|
| 192 | - $entry = $manifest[$manifestKey] ?? null; |
|
| 193 | - if (!$entry) { |
|
| 194 | - return []; |
|
| 195 | - } |
|
| 196 | - |
|
| 197 | - $imports = $entry['imports'] ?? []; |
|
| 198 | - foreach($imports as $import) { |
|
| 199 | - $importFiles[] = $manifest[$import]['file']; |
|
| 200 | - self::extractImportFiles($manifest, $import, $importFiles); |
|
| 201 | - } |
|
| 202 | - |
|
| 203 | - return $importFiles; |
|
| 204 | - } |
|
| 205 | - |
|
| 206 | - /** |
|
| 181 | + /** |
|
| 182 | + * Extract any import files from entries recursively |
|
| 183 | + * |
|
| 184 | + * @param array $manifest |
|
| 185 | + * @param string $manifestKey |
|
| 186 | + * @param array $importFiles |
|
| 187 | + * |
|
| 188 | + * @return array |
|
| 189 | + */ |
|
| 190 | + protected static function extractImportFiles(array $manifest, string $manifestKey, array &$importFiles): array |
|
| 191 | + { |
|
| 192 | + $entry = $manifest[$manifestKey] ?? null; |
|
| 193 | + if (!$entry) { |
|
| 194 | + return []; |
|
| 195 | + } |
|
| 196 | + |
|
| 197 | + $imports = $entry['imports'] ?? []; |
|
| 198 | + foreach($imports as $import) { |
|
| 199 | + $importFiles[] = $manifest[$import]['file']; |
|
| 200 | + self::extractImportFiles($manifest, $import, $importFiles); |
|
| 201 | + } |
|
| 202 | + |
|
| 203 | + return $importFiles; |
|
| 204 | + } |
|
| 205 | + |
|
| 206 | + /** |
|
| 207 | 207 | * Extract any CSS files from entries recursively |
| 208 | 208 | * |
| 209 | 209 | * @param array $manifest |