forked from TYPO3/Fluid
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathElseViewHelper.php
More file actions
76 lines (69 loc) · 1.78 KB
/
ElseViewHelper.php
File metadata and controls
76 lines (69 loc) · 1.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<?php
namespace TYPO3Fluid\Fluid\ViewHelpers;
/*
* This file belongs to the package "TYPO3 Fluid".
* See LICENSE.txt that was shipped with this package.
*/
use TYPO3Fluid\Fluid\Core\Compiler\TemplateCompiler;
use TYPO3Fluid\Fluid\Core\Parser\SyntaxTree\ViewHelperNode;
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
/**
* Else-Branch of a condition. Only has an effect inside of ``f:if``.
* See the ``f:if`` ViewHelper for documentation.
*
* Examples
* ========
*
* Output content if condition is not met
* --------------------------------------
*
* ::
*
* <f:if condition="{someCondition}">
* <f:else>
* condition was not true
* </f:else>
* </f:if>
*
* Output::
*
* Everything inside the "else" tag is displayed if the condition evaluates to FALSE.
* Otherwise nothing is outputted in this example.
*
* @see TYPO3Fluid\Fluid\ViewHelpers\IfViewHelper
* @api
*/
class ElseViewHelper extends AbstractViewHelper
{
/**
* @var boolean
*/
protected $escapeOutput = false;
/**
* @return void
*/
public function initializeArguments()
{
$this->registerArgument('if', 'boolean', 'Condition expression conforming to Fluid boolean rules');
}
/**
* @return string the rendered string
* @api
*/
public function render()
{
return $this->renderChildren();
}
/**
* @param string $argumentsName
* @param string $closureName
* @param string $initializationPhpCode
* @param ViewHelperNode $node
* @param TemplateCompiler $compiler
* @return string|NULL
*/
public function compile($argumentsName, $closureName, &$initializationPhpCode, ViewHelperNode $node, TemplateCompiler $compiler)
{
return '\'\'';
}
}