TYPO3  7.6
fluid/Classes/ViewHelpers/Be/PagePathViewHelper.php
Go to the documentation of this file.
1 <?php
2 namespace TYPO3\CMS\Fluid\ViewHelpers\Be;
3 
4 /* *
5  * This script is backported from the TYPO3 Flow package "TYPO3.Fluid". *
6  * *
7  * It is free software; you can redistribute it and/or modify it under *
8  * the terms of the GNU Lesser General Public License, either version 3 *
9  * of the License, or (at your option) any later version. *
10  * *
11  * *
12  * This script is distributed in the hope that it will be useful, but *
13  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- *
14  * TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser *
15  * General Public License for more details. *
16  * *
17  * You should have received a copy of the GNU Lesser General Public *
18  * License along with the script. *
19  * If not, see http://www.gnu.org/licenses/lgpl.html *
20  * *
21  * The TYPO3 project - inspiring people to share! *
22  * */
23 
28 
43 {
50  public function render()
51  {
52  return static::renderStatic(
53  array(),
55  $this->renderingContext
56  );
57  }
58 
67  {
68  $id = GeneralUtility::_GP('id');
69  $pageRecord = BackendUtility::readPageAccess($id, $GLOBALS['BE_USER']->getPagePermsClause(1));
70  // Is this a real page
71  if ($pageRecord['uid']) {
72  $title = $pageRecord['_thePathFull'];
73  } else {
74  $title = $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'];
75  }
76  // Setting the path of the page
77  $pagePath = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:labels.path', true) . ': <span class="typo3-docheader-pagePath">';
78  // crop the title to title limit (or 50, if not defined)
79  $cropLength = empty($GLOBALS['BE_USER']->uc['titleLen']) ? 50 : $GLOBALS['BE_USER']->uc['titleLen'];
80  $croppedTitle = GeneralUtility::fixed_lgd_cs($title, -$cropLength);
81  if ($croppedTitle !== $title) {
82  $pagePath .= '<abbr title="' . htmlspecialchars($title) . '">' . htmlspecialchars($croppedTitle) . '</abbr>';
83  } else {
84  $pagePath .= htmlspecialchars($title);
85  }
86  $pagePath .= '</span>';
87  return $pagePath;
88  }
89 }