TYPO3 CMS  TYPO3_8-7
PageInfoViewHelper.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 
22 
37 {
38 
44  protected $escapeOutput = false;
45 
52  public function render()
53  {
54  return static::renderStatic(
55  [],
56  $this->buildRenderChildrenClosure(),
57  $this->renderingContext
58  );
59  }
60 
68  public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
69  {
70  $id = GeneralUtility::_GP('id');
71  $pageRecord = BackendUtility::readPageAccess($id, $GLOBALS['BE_USER']->getPagePermsClause(1));
72  // Add icon with context menu, etc:
74  $iconFactory = GeneralUtility::makeInstance(IconFactory::class);
75  if ($pageRecord['uid']) {
76  // If there IS a real page
77  $altText = BackendUtility::getRecordIconAltText($pageRecord, 'pages');
78  $theIcon = '<span title="' . $altText . '">' . $iconFactory->getIconForRecord('pages', $pageRecord, Icon::SIZE_SMALL)->render() . '</span>';
79  // Make Icon:
80  $theIcon = BackendUtility::wrapClickMenuOnIcon($theIcon, 'pages', $pageRecord['uid']);
81 
82  // Setting icon with context menu + uid
83  $theIcon .= ' <em>[PID: ' . $pageRecord['uid'] . ']</em>';
84  } else {
85  // On root-level of page tree
86  // Make Icon
87  $theIcon = '<span title="' . htmlspecialchars($GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']) . '">' . $iconFactory->getIcon('apps-pagetree-page-domain', Icon::SIZE_SMALL)->render() . '</span>';
88  if ($GLOBALS['BE_USER']->user['admin']) {
89  $theIcon = BackendUtility::wrapClickMenuOnIcon($theIcon, 'pages', 0);
90  }
91  }
92  return $theIcon;
93  }
94 }
static readPageAccess($id, $perms_clause)
static wrapClickMenuOnIcon( $content, $table, $uid=0, $context='', $_addParams='', $_enDisItems='', $returnTagParameters=false)
static makeInstance($className,... $constructorArguments)
static getRecordIconAltText($row, $table='pages')
if(TYPO3_MODE==='BE') $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tsfebeuserauth.php']['frontendEditingController']['default']