TYPO3 CMS  TYPO3_7-6
TYPO3\CMS\Fluid\ViewHelpers\Security\IfHasRoleViewHelper Class Reference
Inheritance diagram for TYPO3\CMS\Fluid\ViewHelpers\Security\IfHasRoleViewHelper:
TYPO3\CMS\Fluid\Core\ViewHelper\AbstractConditionViewHelper TYPO3\CMS\Fluid\Core\ViewHelper\Facets\CompilableInterface TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper TYPO3\CMS\Fluid\Core\ViewHelper\Facets\ChildNodeAccessInterface

Public Member Functions

 initializeArguments ()
 
- Public Member Functions inherited from TYPO3\CMS\Fluid\Core\ViewHelper\AbstractConditionViewHelper
 setChildNodes (array $childNodes)
 
 __construct ()
 
 render ()
 
 compile ($argumentsVariableName, $renderChildrenClosureVariableName, &$initializationPhpCode, \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\AbstractNode $syntaxTreeNode, \TYPO3\CMS\Fluid\Core\Compiler\TemplateCompiler $templateCompiler)
 
- Public Member Functions inherited from TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper
 setArguments (array $arguments)
 
 setRenderingContext (\TYPO3\CMS\Fluid\Core\Rendering\RenderingContextInterface $renderingContext)
 
 injectObjectManager (\TYPO3\CMS\Extbase\Object\ObjectManagerInterface $objectManager)
 
 injectReflectionService (\TYPO3\CMS\Extbase\Reflection\ReflectionService $reflectionService)
 
 isEscapingInterceptorEnabled ()
 
 setViewHelperNode (\TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\ViewHelperNode $node)
 
 setRenderChildrenClosure (\Closure $renderChildrenClosure)
 
 initializeArgumentsAndRender ()
 
 initialize ()
 
 renderChildren ()
 
 prepareArguments ()
 
 validateArguments ()
 
 initializeArguments ()
 
 compile ($argumentsVariableName, $renderChildrenClosureVariableName, &$initializationPhpCode, \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\AbstractNode $syntaxTreeNode, \TYPO3\CMS\Fluid\Core\Compiler\TemplateCompiler $templateCompiler)
 
 resetState ()
 
- Public Member Functions inherited from TYPO3\CMS\Fluid\Core\ViewHelper\Facets\CompilableInterface
 compile ($argumentsVariableName, $renderChildrenClosureVariableName, &$initializationPhpCode, \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\AbstractNode $syntaxTreeNode, \TYPO3\CMS\Fluid\Core\Compiler\TemplateCompiler $templateCompiler)
 

Static Protected Member Functions

static evaluateCondition ($arguments=null)
 
- Static Protected Member Functions inherited from TYPO3\CMS\Fluid\Core\ViewHelper\AbstractConditionViewHelper
static renderStaticThenChild ($arguments, &$hasEvaluated)
 
static renderStaticElseChild ($arguments, &$hasEvaluated)
 
static evaluateCondition ($arguments=null)
 

Additional Inherited Members

- Static Public Member Functions inherited from TYPO3\CMS\Fluid\Core\ViewHelper\AbstractConditionViewHelper
static renderStatic (array $arguments, \Closure $renderChildrenClosure, \TYPO3\CMS\Fluid\Core\Rendering\RenderingContextInterface $renderingContext)
 
- Static Public Member Functions inherited from TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper
static renderStatic (array $arguments, \Closure $renderChildrenClosure, \TYPO3\CMS\Fluid\Core\Rendering\RenderingContextInterface $renderingContext)
 
- Static Public Member Functions inherited from TYPO3\CMS\Fluid\Core\ViewHelper\Facets\CompilableInterface
static renderStatic (array $arguments, \Closure $renderChildrenClosure, \TYPO3\CMS\Fluid\Core\Rendering\RenderingContextInterface $renderingContext)
 
- Protected Member Functions inherited from TYPO3\CMS\Fluid\Core\ViewHelper\AbstractConditionViewHelper
 renderThenChild ()
 
 renderElseChild ()
 
- Protected Member Functions inherited from TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper
 registerArgument ($name, $type, $description, $required=false, $defaultValue=null)
 
 overrideArgument ($name, $type, $description, $required=false, $defaultValue=null)
 
 callRenderMethod ()
 
 getLogger ()
 
 buildRenderChildrenClosure ()
 
 hasArgument ($argumentName)
 
- Protected Attributes inherited from TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper
 $arguments
 
 $templateVariableContainer
 
 $controllerContext
 
 $renderingContext
 
 $renderChildrenClosure = null
 
 $viewHelperVariableContainer
 
 $objectManager
 
 $escapingInterceptorEnabled = true
 

Detailed Description

This view helper implements an ifHasRole/else condition for FE users/groups.

= Examples =

<f:security.ifHasRole role="Administrator"> This is being shown in case the current FE user belongs to a FE usergroup (aka role) titled "Administrator" (case sensitive) </f:security.ifHasRole> <output> Everything inside the <f:ifHasRole> tag is being displayed if the logged in FE user belongs to the specified role. </output>

<f:security.ifHasRole role="1"> This is being shown in case the current FE user belongs to a FE usergroup (aka role) with the uid "1" </f:security.ifHasRole> <output> Everything inside the <f:ifHasRole> tag is being displayed if the logged in FE user belongs to the specified role. </output>

<f:security.ifHasRole role="Administrator"> <f:then> This is being shown in case you have the role. </f:then> <f:else> This is being displayed in case you do not have the role. </f:else> </f:security.ifHasRole> <output> Everything inside the "then" tag is displayed if the logged in FE user belongs to the specified role. Otherwise, everything inside the "else"-tag is displayed. </output>

Definition at line 63 of file IfHasRoleViewHelper.php.

Member Function Documentation

◆ evaluateCondition()

static TYPO3\CMS\Fluid\ViewHelpers\Security\IfHasRoleViewHelper::evaluateCondition (   $arguments = null)
staticprotected

This method decides if the condition is TRUE or FALSE. It can be overriden in extending viewhelpers to adjust functionality.

Parameters
array$argumentsViewHelper arguments to evaluate the condition for this ViewHelper, allows for flexiblity in overriding this method.
Returns
bool

Definition at line 83 of file IfHasRoleViewHelper.php.

References TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper\$arguments, and $GLOBALS.

◆ initializeArguments()

TYPO3\CMS\Fluid\ViewHelpers\Security\IfHasRoleViewHelper::initializeArguments ( )

Initializes the "role" argument. Renders <f:then> child if the current logged in FE user belongs to the specified role (aka usergroup) otherwise renders <f:else> child.

Returns
void

Definition at line 72 of file IfHasRoleViewHelper.php.

References TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper\registerArgument().