[BUGFIX] Make clear cache error notification translatable
[Packages/TYPO3.CMS.git] / typo3 / sysext / fluid / Classes / ViewHelpers / Security / IfAuthenticatedViewHelper.php
1 <?php
2 namespace TYPO3\CMS\Fluid\ViewHelpers\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 TYPO3\CMS\Core\Context\Context;
18 use TYPO3\CMS\Core\Utility\GeneralUtility;
19 use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractConditionViewHelper;
20
21 /**
22 * This ViewHelper implements an ifAuthenticated/else condition for frontend users.
23 *
24 * Examples
25 * ========
26 *
27 * Basic usage
28 * -----------
29 *
30 * ::
31 *
32 * <f:security.ifAuthenticated>
33 * This is being shown whenever a FE user is logged in
34 * </f:security.ifAuthenticated>
35 *
36 * Everything inside the :html:`<f:security.ifAuthenticated>` tag is being displayed if
37 * current frontend user is authenticated.
38 *
39 * IfAuthenticated / then / else
40 * -----------------------------
41 *
42 * ::
43 *
44 * <f:security.ifAuthenticated>
45 * <f:then>
46 * This is being shown in case you have access.
47 * </f:then>
48 * <f:else>
49 * This is being displayed in case you do not have access.
50 * </f:else>
51 * </f:security.ifAuthenticated>
52 *
53 * Everything inside the :html:`<f:then></f:then>` tag is displayed if frontend user is authenticated.
54 * Otherwise, everything inside the :html:`<f:else></f:else>` tag is displayed.
55 */
56 class IfAuthenticatedViewHelper extends AbstractConditionViewHelper
57 {
58 /**
59 * This method decides if the condition is TRUE or FALSE. It can be overridden in extending viewhelpers to adjust functionality.
60 *
61 * @param array $arguments ViewHelper arguments to evaluate the condition for this ViewHelper, allows for flexibility in overriding this method.
62 * @return bool
63 */
64 protected static function evaluateCondition($arguments = null)
65 {
66 return GeneralUtility::makeInstance(Context::class)->getPropertyFromAspect('frontend.user', 'id', 0) > 0;
67 }
68 }