You are here

class RouteService 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
  2. 8.2 src/Routing/RouteService.php \Drupal\health_check_url\Routing\RouteService

Route service class.

Hierarchy

Expanded class hierarchy of RouteService

1 string reference to 'RouteService'
health_check_url.services.yml in ./health_check_url.services.yml
health_check_url.services.yml
1 service uses RouteService
health_check_url.route_service in ./health_check_url.services.yml
Drupal\health_check_url\Routing\RouteService

File

src/Routing/RouteService.php, line 12

Namespace

Drupal\health_check_url\Routing
View source
class RouteService {

  /**
   * The stream wrapper manager service.
   *
   * @var \Drupal\Core\Config\ImmutableConfig
   *   ImmutableConfig.
   */
  protected $settings;

  /**
   * @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
   *   The config factory.
   */
  public function __construct(ConfigFactoryInterface $config_factory) {
    $this->settings = $config_factory
      ->get('health_check_url.settings');
  }

  /**
   * {@inheritdoc}
   */
  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;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
RouteService::$settings protected property The stream wrapper manager service.
RouteService::routes public function
RouteService::__construct public function