protected function RouteHelper::getThemeCompilerRoutes in Theme Compiler 2.0.x
Same name and namespace in other branches
- 8 src/Routing/RouteHelper.php \Drupal\theme_compiler\Routing\RouteHelper::getThemeCompilerRoutes()
Generate a list of routes for a specific compiler's targets.
Parameters
string $theme: The machine name of the theme for which routes should be generated.
string $compiler: The machine name of the compiler for which routes should be generated.
array $targets: An array of compiler target options keyed by a theme-relative target path.
Return value
\Generator A collection of routes for the provided compiler's targets.
1 call to RouteHelper::getThemeCompilerRoutes()
- RouteHelper::getThemeRoutes in src/
Routing/ RouteHelper.php - Generate a list of routes for a specific theme's compiler configuration.
File
- src/
Routing/ RouteHelper.php, line 120
Class
- RouteHelper
- Builds the route(s) that facilitate compilation of theme-provided assets.
Namespace
Drupal\theme_compiler\RoutingCode
protected function getThemeCompilerRoutes(string $theme, string $compiler, array $targets) : \Generator {
// Iterate over each target for this compiler for processing.
foreach ($targets as $path => $config) {
// Create a compiler context using this target's configuration; then
// create a route using the compiler context.
$context = $this
->getThemeCompilerContext($theme, $compiler, $path, $config);
$route = $this
->getThemeCompilerTargetRoute($context);
// Generate a keyed element for this route.
(yield "theme_compiler.{$context->getOption('theme_compiler')['id']}" => $route);
}
}