You are here

public function StyleguideRoutes::routes in Style Guide 8

Same name and namespace in other branches
  1. 2.x src/StyleguideRoutes.php \Drupal\styleguide\StyleguideRoutes::routes()

File

src/StyleguideRoutes.php, line 42

Class

StyleguideRoutes
The Styleguide routers.

Namespace

Drupal\styleguide

Code

public function routes() {
  $routes = [];
  $themes = $this->themeHandler
    ->rebuildThemeData();
  foreach ($themes as &$theme) {
    if (!empty($theme->info['hidden'])) {
      continue;
    }
    if ($theme->status) {
      $name = $theme
        ->getName();
      $routes['styleguide.' . $name] = new Route('/admin/appearance/styleguide/' . $name, [
        '_controller' => 'Drupal\\styleguide\\Controller\\StyleguideController::page',
        '_title' => $theme->info['name'],
      ], [
        '_permission' => 'view style guides',
      ], [
        '_admin_route' => FALSE,
      ]);
      $routes['styleguide.maintenance_page.' . $name] = new Route('/admin/appearance/styleguide/maintenance-page/' . $name, [
        '_controller' => 'Drupal\\styleguide\\Controller\\StyleguideMaintenancePageController::page',
        '_title' => $theme->info['name'],
      ], [
        '_permission' => 'view style guides',
      ], [
        '_admin_route' => FALSE,
      ]);
    }
  }
  return $routes;
}