[TASK] Streamline phpdoc annotations in EXT:fluid
[Packages/TYPO3.CMS.git] / typo3 / sysext / fluid / Classes / ViewHelpers / Be / Security / IfAuthenticatedViewHelper.php
1 <?php
2 namespace TYPO3\CMS\Fluid\ViewHelpers\Be\Security;
3
4 /*
5 * This file is part of the TYPO3 CMS project.
6 *
7 * It is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU General Public License, either version 2
9 * of the License, or any later version.
10 *
11 * For the full copyright and license information, please read the
12 * LICENSE.txt file that was distributed with this source code.
13 *
14 * The TYPO3 project - inspiring people to share!
15 */
16
17 use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractConditionViewHelper;
18
19 /**
20 * This view helper implements an ifAuthenticated/else condition for BE users/groups.
21 *
22 * = Examples =
23 *
24 * <code title="Basic usage">
25 * <f:be.security.ifAuthenticated>
26 * This is being shown whenever a BE user is logged in
27 * </f:be.security.ifAuthenticated>
28 * </code>
29 * <output>
30 * Everything inside the <f:be.ifAuthenticated> tag is being displayed if you are authenticated with any BE user account.
31 * </output>
32 *
33 * <code title="IfAuthenticated / then / else">
34 * <f:be.security.ifAuthenticated>
35 * <f:then>
36 * This is being shown in case you have access.
37 * </f:then>
38 * <f:else>
39 * This is being displayed in case you do not have access.
40 * </f:else>
41 * </f:be.security.ifAuthenticated>
42 * </code>
43 * <output>
44 * Everything inside the "then" tag is displayed if you have access.
45 * Otherwise, everything inside the "else"-tag is displayed.
46 * </output>
47 */
48 class IfAuthenticatedViewHelper extends AbstractConditionViewHelper
49 {
50 /**
51 * This method decides if the condition is TRUE or FALSE. It can be overridden in extending viewhelpers to adjust functionality.
52 *
53 * @param array $arguments ViewHelper arguments to evaluate the condition for this ViewHelper, allows for flexiblity in overriding this method.
54 * @return bool
55 */
56 protected static function evaluateCondition($arguments = null)
57 {
58 return isset($GLOBALS['BE_USER']) && $GLOBALS['BE_USER']->user['uid'] > 0;
59 }
60 }