* ``` * * **Note:** This ViewHelper is experimental! * * @see https://docs.typo3.org/permalink/t3viewhelper:typo3-fluid-be-pagepath * @deprecated since TYPO3 v15.0, will be removed in TYPO3 v16.0. */ final class PagePathViewHelper extends AbstractViewHelper implements ViewHelperNodeInitializedEventInterface { /** * This ViewHelper renders HTML, thus output must not be escaped * * @var bool */ protected $escapeOutput = false; public function render(): string { $id = 0; if ($this->renderingContext->hasAttribute(ServerRequestInterface::class)) { $request = $this->renderingContext->getAttribute(ServerRequestInterface::class); $id = $request->getParsedBody()['id'] ?? $request->getQueryParams()['id'] ?? 0; } $pageRecord = BackendUtility::readPageAccess($id, $GLOBALS['BE_USER']->getPagePermsClause(Permission::PAGE_SHOW)); // Is this a real page if ($pageRecord['_thePathFull'] ?? false) { $title = (string)$pageRecord['_thePathFull']; } else { $title = (string)$GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']; } // Setting the path of the page $pagePath = htmlspecialchars(self::getLanguageService()->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.path')) . ': '; $croppedTitle = BackendUtility::cropToTitleLength($title, null, true); if ($croppedTitle !== $title) { $pagePath .= '' . htmlspecialchars($croppedTitle) . ''; } else { $pagePath .= htmlspecialchars($title); } $pagePath .= ''; return $pagePath; } public static function nodeInitializedEvent(ViewHelperNode $node, array $arguments, ParsingState $parsingState): void { trigger_error( ' has been deprecated in TYPO3 v15.0 and will be removed in v16.0.', E_USER_DEPRECATED ); } private static function getLanguageService(): LanguageService { return $GLOBALS['LANG']; } }