|
1
|
|
|
<?php |
|
2
|
|
|
namespace TYPO3Fluid\Fluid\ViewHelpers\Format; |
|
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\Rendering\RenderingContextInterface; |
|
12
|
|
|
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper; |
|
13
|
|
|
use TYPO3Fluid\Fluid\Core\ViewHelper\Traits\CompileWithRenderStatic; |
|
14
|
|
|
|
|
15
|
|
|
/** |
|
16
|
|
|
* Hides, but still executes, the tag content. |
|
17
|
|
|
* |
|
18
|
|
|
* Useful when you have Fluid code that you want to execute |
|
19
|
|
|
* but do not wish to output. For example, around variable |
|
20
|
|
|
* assignments to remove resulting whitespace. |
|
21
|
|
|
* |
|
22
|
|
|
* = Examples = |
|
23
|
|
|
* |
|
24
|
|
|
* <code title="Hiding output"> |
|
25
|
|
|
* <f:format.hide> |
|
26
|
|
|
* <!-- Everything inside the tag is executed but not output --> |
|
27
|
|
|
* <!-- |
|
28
|
|
|
* Which menas that among other things, you can use HTML |
|
29
|
|
|
* comments which will not be output but are visible to |
|
30
|
|
|
* developers reading the template source code. |
|
31
|
|
|
* --> |
|
32
|
|
|
* {string -> f:format.htmlspecialchars() -> f:variable(name: 'newvariable')} |
|
33
|
|
|
* </f:format.hide> |
|
34
|
|
|
* </code> |
|
35
|
|
|
* <output> |
|
36
|
|
|
* (Content of {string} without any conversion/escaping) |
|
37
|
|
|
* </output> |
|
38
|
|
|
* |
|
39
|
|
|
* @api |
|
40
|
|
|
*/ |
|
41
|
|
|
class HideViewHelper extends AbstractViewHelper |
|
42
|
|
|
{ |
|
43
|
|
|
use CompileWithRenderStatic; |
|
44
|
|
|
|
|
45
|
|
|
/** |
|
46
|
|
|
* @param array $arguments |
|
47
|
|
|
* @param \Closure $renderChildrenClosure |
|
48
|
|
|
* @param RenderingContextInterface $renderingContext |
|
49
|
|
|
* @return mixed |
|
50
|
|
|
*/ |
|
51
|
|
|
public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext) |
|
52
|
|
|
{ |
|
53
|
|
|
$renderChildrenClosure(); |
|
54
|
|
|
} |
|
55
|
|
|
|
|
56
|
|
|
} |
|
57
|
|
|
|