‪TYPO3CMS  10.4
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 
22 use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
23 
40 {
41 
47  protected ‪$escapeOutput = false;
48 
54  public function ‪render()
55  {
56  return static::renderStatic(
57  [],
58  $this->buildRenderChildrenClosure(),
59  $this->renderingContext
60  );
61  }
62 
70  public static function ‪renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
71  {
72  $id = GeneralUtility::_GP('id');
73  $pageRecord = ‪BackendUtility::readPageAccess($id, ‪$GLOBALS['BE_USER']->getPagePermsClause(‪Permission::PAGE_SHOW));
74  // Is this a real page
75  if ($pageRecord['_thePathFull'] ?? false) {
76  $title = (string)$pageRecord['_thePathFull'];
77  } else {
78  $title = (string)‪$GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'];
79  }
80  // Setting the path of the page
81  $pagePath = htmlspecialchars(static::getLanguageService()->sL('LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.path')) . ': <span class="typo3-docheader-pagePath">';
82  // crop the title to title limit (or 50, if not defined)
83  $cropLength = empty(‪$GLOBALS['BE_USER']->uc['titleLen']) ? 50 : ‪$GLOBALS['BE_USER']->uc['titleLen'];
84  $cropLength = (int)$cropLength;
85  $croppedTitle = GeneralUtility::fixed_lgd_cs($title, -$cropLength);
86  if ($croppedTitle !== $title) {
87  $pagePath .= '<abbr title="' . htmlspecialchars($title) . '">' . htmlspecialchars($croppedTitle) . '</abbr>';
88  } else {
89  $pagePath .= htmlspecialchars($title);
90  }
91  $pagePath .= '</span>';
92  return $pagePath;
93  }
94 
98  protected static function ‪getLanguageService(): ?‪LanguageService
99  {
100  return ‪$GLOBALS['LANG'] ?? null;
101  }
102 }
‪TYPO3\CMS\Fluid\ViewHelpers\Be\PagePathViewHelper\getLanguageService
‪static LanguageService null getLanguageService()
Definition: PagePathViewHelper.php:97
‪TYPO3\CMS\Fluid\ViewHelpers\Be\PagePathViewHelper
Definition: PagePathViewHelper.php:40
‪TYPO3\CMS\Fluid\ViewHelpers\Be\PagePathViewHelper\$escapeOutput
‪bool $escapeOutput
Definition: PagePathViewHelper.php:46
‪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:24
‪TYPO3\CMS\Fluid\ViewHelpers\Be\PagePathViewHelper\renderStatic
‪static string renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
Definition: PagePathViewHelper.php:69
‪TYPO3\CMS\Core\Type\Bitmask\Permission\PAGE_SHOW
‪const PAGE_SHOW
Definition: Permission.php:33
‪TYPO3\CMS\Backend\Utility\BackendUtility
Definition: BackendUtility.php:75
‪TYPO3\CMS\Backend\Utility\BackendUtility\readPageAccess
‪static array false readPageAccess($id, $perms_clause)
Definition: BackendUtility.php:597
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:5
‪TYPO3\CMS\Core\Localization\LanguageService
Definition: LanguageService.php:42
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:46
‪TYPO3\CMS\Fluid\ViewHelpers\Be\PagePathViewHelper\render
‪string render()
Definition: PagePathViewHelper.php:53