You are here

protected function RouteHelper::getThemeCompilerRoutes in Theme Compiler 8

Same name and namespace in other branches
  1. 2.0.x src/Routing/RouteHelper.php \Drupal\theme_compiler\Routing\RouteHelper::getThemeCompilerRoutes()

Generate a list of routes for a specific theme 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 theme compiler target options keyed by a theme-relative target path.

Return value

\Symfony\Component\Routing\Route[] A collection of routes for the provided theme 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 56

Class

RouteHelper
Builds the dynamic routes provided by this theme.

Namespace

Drupal\theme_compiler\Routing

Code

protected function getThemeCompilerRoutes(string $theme, string $compiler, array $targets) {

  // Iterate over each target for this theme compiler for processing.
  foreach ($targets as $target => $options) {

    // Construct the theme compiler target context used for execution.
    $context = new ThemeCompilerTargetContext($compiler, $theme, $target, $options);

    // Build the route using the resulting context.
    $route = $this
      ->getThemeCompilerTargetRoute($context);

    // Generate a named array entry for this route.
    (yield "theme_compiler.{$context->getTargetId()}" => $route);
  }
}