class StyleguideRoutes in Style Guide 8
Same name and namespace in other branches
- 2.x src/StyleguideRoutes.php \Drupal\styleguide\StyleguideRoutes
The Styleguide routers.
Hierarchy
- class \Drupal\styleguide\StyleguideRoutes implements ContainerInjectionInterface
Expanded class hierarchy of StyleguideRoutes
1 string reference to 'StyleguideRoutes'
1 service uses StyleguideRoutes
File
- src/
StyleguideRoutes.php, line 13
Namespace
Drupal\styleguideView source
class StyleguideRoutes implements ContainerInjectionInterface {
/**
* The theme handler service.
*
* @var \Drupal\Core\Extension\ThemeHandlerInterface
*/
protected $themeHandler;
/**
* StyleguideRoutes constructor.
*
* @param \Drupal\Core\Extension\ThemeHandlerInterface $theme_handler
* The theme handler service.
*/
public function __construct(ThemeHandlerInterface $theme_handler) {
$this->themeHandler = $theme_handler;
}
/**
* {@inheritdoc}
*/
public static function create(ContainerInterface $container) {
new static($container
->get('theme_handler'));
}
/**
* {@inheritdoc}
*/
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;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
StyleguideRoutes:: |
protected | property | The theme handler service. | |
StyleguideRoutes:: |
public static | function |
Instantiates a new instance of this class. Overrides ContainerInjectionInterface:: |
|
StyleguideRoutes:: |
public | function | ||
StyleguideRoutes:: |
public | function | StyleguideRoutes constructor. |