You are here

public function RouteService::routes in Health Check Url 8

Same name and namespace in other branches
  1. 8.3 src/Routing/RouteService.php \Drupal\health_check_url\Routing\RouteService::routes()
  2. 8.2 src/Routing/RouteService.php \Drupal\health_check_url\Routing\RouteService::routes()

File

src/Routing/RouteService.php, line 33

Class

RouteService
Route service class.

Namespace

Drupal\health_check_url\Routing

Code

public function routes() {
  $route_collection = new RouteCollection();
  $endpoint = !empty($this->settings
    ->get('endpoint')) ? trim($this->settings
    ->get('endpoint'), '/') : 'health';
  $maintainence_access = $this->settings
    ->get('maintainence_access');
  $route = new Route('/' . $endpoint, [
    '_controller' => '\\Drupal\\health_check_url\\Controller\\HealthCheckController::healthCheckUrl',
    '_title' => 'Health Check URL',
    '_disable_route_normalizer' => 'TRUE',
  ], [
    '_access' => 'TRUE',
  ], [
    'no_cache' => 'TRUE',
    '_maintenance_access' => $maintainence_access === TRUE ? TRUE : FALSE,
  ]);
  $route_collection
    ->add('health_check_url.content', $route);
  $route = new Route('/admin/config/development/health', [
    '_form' => '\\Drupal\\health_check_url\\Form\\HealthCheckSettingsForm',
    '_title' => 'Health Check URL settings',
  ], [
    '_permission' => 'health_check_url administration',
  ]);
  $route_collection
    ->add('health_check_url.admin', $route);
  return $route_collection;
}