public PathMatcher::isFrontPage()
Checks if the current page is the front page.
bool TRUE if the current page is the front page.
Overrides PathMatcherInterface::isFrontPage
public function isFrontPage() { // Cache the result as this is called often. if (!isset($this->isCurrentFrontPage)) { $this->isCurrentFrontPage = FALSE; // Ensure that the code can also be executed when there is no active // route match, like on exception responses. if ($this->routeMatch->getRouteName()) { $url = Url::fromRouteMatch($this->routeMatch); $this->isCurrentFrontPage = ($url->getRouteName() && '/' . $url->getInternalPath() === $this->getFrontPagePath()); } } return $this->isCurrentFrontPage; }
© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Path!PathMatcher.php/function/PathMatcher::isFrontPage/8.1.x