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