TYPO3
7.6
Users
bogdan
Projects
Kapeli
Resources
Dash
Docsets
TYPO3
src
typo3
sysext
fluid
Classes
ViewHelpers
Be
PageInfoViewHelper.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
24
use
TYPO3\CMS\Backend\Utility\BackendUtility
;
25
use
TYPO3\CMS\Core\Imaging\Icon
;
26
use
TYPO3\CMS\Core\Imaging\IconFactory
;
27
use
TYPO3\CMS\Core\Utility\GeneralUtility
;
28
use
TYPO3\CMS\Fluid\Core\Rendering\RenderingContextInterface
;
29
use
TYPO3\CMS\Fluid\Core\ViewHelper\Facets\CompilableInterface
;
30
44
class
PageInfoViewHelper
extends
AbstractBackendViewHelper
implements
CompilableInterface
45
{
52
public
function
render
()
53
{
54
return
static::renderStatic(
55
array(),
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 clickmenu, 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 clickmenu + 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
}
Generated on Wed Nov 11 2015 01:52:00 for TYPO3 by
1.8.3