Completed
Pull Request — master (#214)
by Claus
03:52
created

ElseViewHelper::compile()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 5
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
namespace TYPO3Fluid\Fluid\ViewHelpers;
3
4
/*
5
 * This file belongs to the package "TYPO3 Fluid".
6
 * See LICENSE.txt that was shipped with this package.
7
 */
8
9
use TYPO3Fluid\Fluid\Core\Compiler\TemplateCompiler;
10
use TYPO3Fluid\Fluid\Core\Parser\SyntaxTree\ViewHelperNode;
11
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
12
use TYPO3Fluid\Fluid\Core\ViewHelper\Traits\CompileEmpty;
13
use TYPO3Fluid\Fluid\Core\ViewHelper\Traits\PassthroughRenderChildren;
14
15
/**
16
 * Else-Branch of a condition. Only has an effect inside of "If". See the If-ViewHelper for documentation.
17
 *
18
 * = Examples =
19
 *
20
 * <code title="Output content if condition is not met">
21
 * <f:if condition="{someCondition}">
22
 *   <f:else>
23
 *     condition was not true
24
 *   </f:else>
25
 * </f:if>
26
 * </code>
27
 * <output>
28
 * Everything inside the "else" tag is displayed if the condition evaluates to FALSE.
29
 * Otherwise nothing is outputted in this example.
30
 * </output>
31
 *
32
 * @see TYPO3Fluid\Fluid\ViewHelpers\IfViewHelper
33
 * @api
34
 */
35
class ElseViewHelper extends AbstractViewHelper
36
{
37
    use CompileEmpty;
38
    use PassthroughRenderChildren;
39
40
    /**
41
     * @var boolean
42
     */
43
    protected $escapeOutput = false;
44
45
    /**
46
     * @return void
47
     */
48
    public function initializeArguments()
49
    {
50
        $this->registerArgument('if', 'boolean', 'Condition expression conforming to Fluid boolean rules');
51
    }
52
53
}
54