‪TYPO3CMS  9.5
PagePathViewHelper.php
Go to the documentation of this file.
1 <?php
3 
4 /*
5  * This file is part of the TYPO3 CMS project.
6  *
7  * It is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU General Public License, either version 2
9  * of the License, or any later version.
10  *
11  * For the full copyright and license information, please read the
12  * LICENSE.txt file that was distributed with this source code.
13  *
14  * The TYPO3 project - inspiring people to share!
15  */
16 
20 use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
21 
38 {
39 
45  protected ‪$escapeOutput = false;
46 
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['uid']) {
75  $title = $pageRecord['_thePathFull'];
76  } else {
77  $title = ‪$GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'];
78  }
79  // Setting the path of the page
80  $pagePath = htmlspecialchars(‪$GLOBALS['LANG']->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  $croppedTitle = GeneralUtility::fixed_lgd_cs($title, -$cropLength);
84  if ($croppedTitle !== $title) {
85  $pagePath .= '<abbr title="' . htmlspecialchars($title) . '">' . htmlspecialchars($croppedTitle) . '</abbr>';
86  } else {
87  $pagePath .= htmlspecialchars($title);
88  }
89  $pagePath .= '</span>';
90  return $pagePath;
91  }
92 }
‪TYPO3\CMS\Fluid\ViewHelpers\Be\PagePathViewHelper
Definition: PagePathViewHelper.php:38
‪TYPO3\CMS\Fluid\ViewHelpers\Be\PagePathViewHelper\$escapeOutput
‪bool $escapeOutput
Definition: PagePathViewHelper.php:44
‪TYPO3\CMS\Fluid\ViewHelpers\Be\AbstractBackendViewHelper
Definition: AbstractBackendViewHelper.php:27
‪TYPO3\CMS\Fluid\ViewHelpers\Be
Definition: AbstractBackendViewHelper.php:2
‪TYPO3\CMS\Core\Type\Bitmask\Permission
Definition: Permission.php:23
‪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:32
‪TYPO3\CMS\Backend\Utility\BackendUtility
Definition: BackendUtility.php:72
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:5
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:45
‪TYPO3\CMS\Fluid\ViewHelpers\Be\PagePathViewHelper\render
‪string render()
Definition: PagePathViewHelper.php:52
‪TYPO3\CMS\Backend\Utility\BackendUtility\readPageAccess
‪static array bool readPageAccess($id, $perms_clause)
Definition: BackendUtility.php:635