You are here

protected function RouterPathTranslatorSubscriber::resolvedPathIsHomePath in Decoupled Router 8

Same name and namespace in other branches
  1. 2.x src/EventSubscriber/RouterPathTranslatorSubscriber.php \Drupal\decoupled_router\EventSubscriber\RouterPathTranslatorSubscriber::resolvedPathIsHomePath()

Checks if the resolved path is the home path.

Parameters

string $resolved_url: The resolved url from the request.

Return value

bool True if the resolved path is the home path, false otherwise.

1 call to RouterPathTranslatorSubscriber::resolvedPathIsHomePath()
RouterPathTranslatorSubscriber::onPathTranslation in src/EventSubscriber/RouterPathTranslatorSubscriber.php
Processes a path translation request.

File

src/EventSubscriber/RouterPathTranslatorSubscriber.php, line 381

Class

RouterPathTranslatorSubscriber
Event subscriber that processes a path translation with the router info.

Namespace

Drupal\decoupled_router\EventSubscriber

Code

protected function resolvedPathIsHomePath($resolved_url) {
  $home_path = $this->configFactory
    ->get('system.site')
    ->get('page.front');
  $home_url = Url::fromUserInput($home_path, [
    'absolute' => TRUE,
  ])
    ->toString(TRUE)
    ->getGeneratedUrl();
  return $resolved_url === $home_url;
}