‪TYPO3CMS  11.5
PagePathViewHelper.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4  * This file is part of the TYPO3 CMS project.
5  *
6  * It is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU General Public License, either version 2
8  * of the License, or any later version.
9  *
10  * For the full copyright and license information, please read the
11  * LICENSE.txt file that was distributed with this source code.
12  *
13  * The TYPO3 project - inspiring people to share!
14  */
15 
17 
18 use TYPO3\CMS\Backend\Utility\BackendUtility;
22 use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
23 
40 {
46  protected ‪$escapeOutput = false;
47 
53  public function ‪render()
54  {
55  return static::renderStatic(
56  [],
57  $this->buildRenderChildrenClosure(),
58  $this->renderingContext
59  );
60  }
61 
69  public static function ‪renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
70  {
71  $id = GeneralUtility::_GP('id');
72  $pageRecord = BackendUtility::readPageAccess($id, ‪$GLOBALS['BE_USER']->getPagePermsClause(‪Permission::PAGE_SHOW));
73  // Is this a real page
74  if ($pageRecord['_thePathFull'] ?? false) {
75  $title = (string)$pageRecord['_thePathFull'];
76  } else {
77  $title = (string)‪$GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'];
78  }
79  // Setting the path of the page
80  $pagePath = htmlspecialchars(static::getLanguageService()->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.path')) . ': <span class="typo3-docheader-pagePath">';
81  // crop the title to title limit (or 50, if not defined)
82  $cropLength = empty(‪$GLOBALS['BE_USER']->uc['titleLen']) ? 50 : ‪$GLOBALS['BE_USER']->uc['titleLen'];
83  $cropLength = (int)$cropLength;
84  $croppedTitle = GeneralUtility::fixed_lgd_cs($title, -$cropLength);
85  if ($croppedTitle !== $title) {
86  $pagePath .= '<abbr title="' . htmlspecialchars($title) . '">' . htmlspecialchars($croppedTitle) . '</abbr>';
87  } else {
88  $pagePath .= htmlspecialchars($title);
89  }
90  $pagePath .= '</span>';
91  return $pagePath;
92  }
93 
97  protected static function ‪getLanguageService(): ?‪LanguageService
98  {
99  return ‪$GLOBALS['LANG'] ?? null;
100  }
101 }
‪TYPO3\CMS\Fluid\ViewHelpers\Be\PagePathViewHelper\getLanguageService
‪static LanguageService null getLanguageService()
Definition: PagePathViewHelper.php:96
‪TYPO3\CMS\Fluid\ViewHelpers\Be\PagePathViewHelper
Definition: PagePathViewHelper.php:40
‪TYPO3\CMS\Fluid\ViewHelpers\Be\PagePathViewHelper\$escapeOutput
‪bool $escapeOutput
Definition: PagePathViewHelper.php:45
‪TYPO3\CMS\Fluid\ViewHelpers\Be\AbstractBackendViewHelper
Definition: AbstractBackendViewHelper.php:28
‪TYPO3\CMS\Fluid\ViewHelpers\Be
Definition: AbstractBackendViewHelper.php:16
‪TYPO3\CMS\Core\Type\Bitmask\Permission
Definition: Permission.php:26
‪TYPO3\CMS\Fluid\ViewHelpers\Be\PagePathViewHelper\renderStatic
‪static string renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
Definition: PagePathViewHelper.php:68
‪TYPO3\CMS\Core\Type\Bitmask\Permission\PAGE_SHOW
‪const PAGE_SHOW
Definition: Permission.php:35
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:25
‪TYPO3\CMS\Core\Localization\LanguageService
Definition: LanguageService.php:42
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:50
‪TYPO3\CMS\Fluid\ViewHelpers\Be\PagePathViewHelper\render
‪string render()
Definition: PagePathViewHelper.php:52