You are here

public function ModalPageService::getCurrentPath in Modal 5.0.x

Same name and namespace in other branches
  1. 4.0.x src/Service/ModalPageService.php \Drupal\modal_page\Service\ModalPageService::getCurrentPath()
  2. 4.1.x src/Service/ModalPageService.php \Drupal\modal_page\Service\ModalPageService::getCurrentPath()

Get the current path.

Return value

string The current path.

1 call to ModalPageService::getCurrentPath()
ModalPageService::getModalToShow in src/Service/ModalPageService.php
Get modal to show.

File

src/Service/ModalPageService.php, line 267

Class

ModalPageService
Modal Page Service Class.

Namespace

Drupal\modal_page\Service

Code

public function getCurrentPath() : string {

  // $currentPath = ltrim($this->request->getRequestUri(), '/');.
  $currentPath = $this->request
    ->getRequestUri();
  if ($this->pathMatcher
    ->isFrontPage()) {
    $currentPath = '<front>';
  }
  return $currentPath;
}