public function getPath()
{
// check for site, if so rewrite the path for output
try {
if (\Pimcore\Tool::isFrontend() && Site::isSiteRequest()) {
$site = Site::getCurrentSite();
if ($site instanceof Site) {
if ($site->getRootDocument() instanceof Document\Page && $site->getRootDocument() !== $this) {
$rootPath = $site->getRootPath();
$rootPath = preg_quote($rootPath);
$link = preg_replace("@^" . $rootPath . "@", "", $this->path);
return $link;
}
}
}
} catch (\Exception $e) {
Logger::error($e);
}
return $this->path;
}