‪TYPO3CMS  9.5
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 use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
23 
40 {
41 
47  protected ‪$escapeOutput = false;
48 
55  public function ‪render()
56  {
57  return static::renderStatic(
58  [],
59  $this->buildRenderChildrenClosure(),
60  $this->renderingContext
61  );
62  }
63 
71  public static function ‪renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
72  {
73  $id = GeneralUtility::_GP('id');
74  $pageRecord = ‪BackendUtility::readPageAccess($id, ‪$GLOBALS['BE_USER']->getPagePermsClause(‪Permission::PAGE_SHOW));
75  // Add icon with context menu, etc:
77  $iconFactory = GeneralUtility::makeInstance(IconFactory::class);
78  if ($pageRecord['uid']) {
79  // If there IS a real page
80  $altText = ‪BackendUtility::getRecordIconAltText($pageRecord, 'pages');
81  $theIcon = '<span title="' . $altText . '">' . $iconFactory->getIconForRecord('pages', $pageRecord, ‪Icon::SIZE_SMALL)->render() . '</span>';
82  // Make Icon:
83  $theIcon = ‪BackendUtility::wrapClickMenuOnIcon($theIcon, 'pages', $pageRecord['uid']);
84 
85  // Setting icon with context menu + uid
86  $theIcon .= ' <em>[PID: ' . $pageRecord['uid'] . ']</em>';
87  } else {
88  // On root-level of page tree
89  // Make Icon
90  $theIcon = '<span title="' . htmlspecialchars(‪$GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']) . '">' . $iconFactory->getIcon('apps-pagetree-page-domain', ‪Icon::SIZE_SMALL)->render() . '</span>';
91  if (‪$GLOBALS['BE_USER']->isAdmin()) {
92  $theIcon = ‪BackendUtility::wrapClickMenuOnIcon($theIcon, 'pages');
93  }
94  }
95  return $theIcon;
96  }
97 }
‪TYPO3\CMS\Fluid\ViewHelpers\Be\PageInfoViewHelper\render
‪string render()
Definition: PageInfoViewHelper.php:54
‪TYPO3\CMS\Core\Imaging\Icon\SIZE_SMALL
‪const SIZE_SMALL
Definition: Icon.php:29
‪TYPO3\CMS\Core\Imaging\Icon
Definition: Icon.php:25
‪TYPO3\CMS\Backend\Utility\BackendUtility\getRecordIconAltText
‪static string getRecordIconAltText($row, $table='pages')
Definition: BackendUtility.php:1621
‪TYPO3\CMS\Core\Imaging\IconFactory
Definition: IconFactory.php:31
‪TYPO3\CMS\Fluid\ViewHelpers\Be\AbstractBackendViewHelper
Definition: AbstractBackendViewHelper.php:27
‪TYPO3\CMS\Fluid\ViewHelpers\Be\PageInfoViewHelper
Definition: PageInfoViewHelper.php:40
‪TYPO3\CMS\Fluid\ViewHelpers\Be
Definition: AbstractBackendViewHelper.php:2
‪TYPO3\CMS\Fluid\ViewHelpers\Be\PageInfoViewHelper\renderStatic
‪static string renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
Definition: PageInfoViewHelper.php:70
‪TYPO3\CMS\Core\Type\Bitmask\Permission
Definition: Permission.php:23
‪TYPO3\CMS\Backend\Utility\BackendUtility\wrapClickMenuOnIcon
‪static string wrapClickMenuOnIcon( $content, $table, $uid=0, $context='', $_addParams='', $_enDisItems='', $returnTagParameters=false)
Definition: BackendUtility.php:2759
‪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\Fluid\ViewHelpers\Be\PageInfoViewHelper\$escapeOutput
‪bool $escapeOutput
Definition: PageInfoViewHelper.php:46
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:45
‪TYPO3\CMS\Backend\Utility\BackendUtility\readPageAccess
‪static array bool readPageAccess($id, $perms_clause)
Definition: BackendUtility.php:635