18 use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
19 use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
20 use TYPO3Fluid\Fluid\Core\ViewHelper\Traits\CompileWithRenderStatic;
31 use CompileWithRenderStatic;
50 $this->registerArgument(
'permission',
'int',
'Current permission',
true);
51 $this->registerArgument(
'scope',
'string',
'"user" / "group" / "everybody"',
true);
52 $this->registerArgument(
'pageId',
'int',
'',
true);
64 public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
66 $masks = [1, 16, 2, 4, 8];
68 if (empty(static::$permissionLabels)) {
69 foreach ($masks as $mask) {
71 'LLL:EXT:beuser/Resources/Private/Language/locallang_mod_permission.xlf:' . $mask,
78 foreach ($masks as $mask) {
79 if ($arguments[
'permission'] & $mask) {
80 $permissionClass =
'fa-check text-success';
83 $permissionClass =
'fa-times text-danger';
87 $label = static::$permissionLabels[$mask];
88 $icon .=
'<span style="cursor:pointer"'
89 .
' title="' . htmlspecialchars($label) .
'"'
90 .
' data-toggle="tooltip"'
91 .
' data-page="' . htmlspecialchars($arguments[
'pageId']) .
'"'
92 .
' data-permissions="' . htmlspecialchars($arguments[
'permission']) .
'"'
93 .
' data-who="' . htmlspecialchars($arguments[
'scope']) .
'"'
94 .
' data-bits="' . htmlspecialchars($mask) .
'"'
95 .
' data-mode="' . htmlspecialchars($mode) .
'"'
96 .
' class="t3-icon change-permission fa ' . htmlspecialchars($permissionClass) .
'"></span>';
99 return '<span id="' . htmlspecialchars($arguments[
'pageId'] .
'_' . $arguments[
'scope']) .
'">' . $icon .
'</span>';