‪TYPO3CMS  10.4
PageInfoViewHelper.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 
23 use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
24 
41 {
42 
48  protected ‪$escapeOutput = false;
49 
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:
76  $iconFactory = GeneralUtility::makeInstance(IconFactory::class);
77  if (is_array($pageRecord) && $pageRecord['uid']) {
78  // If there IS a real page
79  $altText = ‪BackendUtility::getRecordIconAltText($pageRecord, 'pages');
80  $theIcon = '<span title="' . $altText . '">' . $iconFactory->getIconForRecord('pages', $pageRecord, ‪Icon::SIZE_SMALL)->render() . '</span>';
81  // Make Icon:
82  $theIcon = ‪BackendUtility::wrapClickMenuOnIcon($theIcon, 'pages', $pageRecord['uid']);
83 
84  // Setting icon with context menu + uid
85  $theIcon .= ' <em>[PID: ' . $pageRecord['uid'] . ']</em>';
86  } else {
87  // On root-level of page tree
88  // Make Icon
89  $theIcon = '<span title="' . htmlspecialchars(‪$GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']) . '">' . $iconFactory->getIcon('apps-pagetree-page-domain', ‪Icon::SIZE_SMALL)->render() . '</span>';
90  if (‪$GLOBALS['BE_USER']->isAdmin()) {
91  $theIcon = ‪BackendUtility::wrapClickMenuOnIcon($theIcon, 'pages');
92  }
93  }
94  return $theIcon;
95  }
96 }
‪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:30
‪TYPO3\CMS\Core\Imaging\Icon
Definition: Icon.php:26
‪TYPO3\CMS\Backend\Utility\BackendUtility\getRecordIconAltText
‪static string getRecordIconAltText($row, $table='pages')
Definition: BackendUtility.php:1357
‪TYPO3\CMS\Core\Imaging\IconFactory
Definition: IconFactory.php:33
‪TYPO3\CMS\Fluid\ViewHelpers\Be\AbstractBackendViewHelper
Definition: AbstractBackendViewHelper.php:28
‪TYPO3\CMS\Fluid\ViewHelpers\Be\PageInfoViewHelper
Definition: PageInfoViewHelper.php:41
‪TYPO3\CMS\Fluid\ViewHelpers\Be
Definition: AbstractBackendViewHelper.php:16
‪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:24
‪TYPO3\CMS\Backend\Utility\BackendUtility\wrapClickMenuOnIcon
‪static string wrapClickMenuOnIcon( $content, $table, $uid=0, $context='', $_addParams='', $_enDisItems='', $returnTagParameters=false)
Definition: BackendUtility.php:2510
‪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\Fluid\ViewHelpers\Be\PageInfoViewHelper\$escapeOutput
‪bool $escapeOutput
Definition: PageInfoViewHelper.php:47
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:46