protected function GlobalredirectSubscriber::isFrontPage in Global Redirect 8
Determine if the given path is the site's front page.
Parameters
string $path: The path to check.
Return value
bool Returns TRUE if the path is the site's front page.
1 call to GlobalredirectSubscriber::isFrontPage()
- GlobalredirectSubscriber::globalredirectFrontPage in src/
EventSubscriber/ GlobalredirectSubscriber.php - Redirects any path that is set as front page to the site root.
File
- src/
EventSubscriber/ GlobalredirectSubscriber.php, line 259 - Contains \Drupal\globalredirect\EventSubscriber\GlobalredirectSubscriber.
Class
- GlobalredirectSubscriber
- KernelEvents::REQUEST subscriber for redirecting q=path/to/page requests.
Namespace
Drupal\globalredirect\EventSubscriberCode
protected function isFrontPage($path) {
// @todo PathMatcher::isFrontPage() doesn't work here for some reason.
$front = \Drupal::config('system.site')
->get('page.front');
// This might be an alias.
$alias_path = \Drupal::service('path.alias_manager')
->getPathByAlias($path);
return !empty($path) && ($path == $front || $alias_path == $front);
}