[BUGFIX] Optimize implementation of CompilableInterface
[Packages/TYPO3.CMS.git] / typo3 / sysext / fluid / Classes / ViewHelpers / CommentViewHelper.php
1 <?php
2 namespace TYPO3\CMS\Fluid\ViewHelpers;
3
4 /* *
5 * This script is backported from the TYPO3 Flow package "TYPO3.Fluid". *
6 * *
7 * It is free software; you can redistribute it and/or modify it under *
8 * the terms of the GNU Lesser General Public License, either version 3 *
9 * of the License, or (at your option) any later version. *
10 * *
11 * The TYPO3 project - inspiring people to share! *
12 * */
13
14 use TYPO3\CMS\Fluid\Core\Rendering\RenderingContextInterface;
15 use TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper;
16 use TYPO3\CMS\Fluid\Core\ViewHelper\Facets\CompilableInterface;
17 use TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\AbstractNode;
18 use TYPO3\CMS\Fluid\Core\Compiler\TemplateCompiler;
19
20 /**
21 * This ViewHelper prevents rendering of any content inside the tag
22 * Note: Contents of the comment will still be **parsed** thus throwing an
23 * Exception if it contains syntax errors. You can put child nodes in
24 * CDATA tags to avoid this.
25 *
26 * = Examples =
27 *
28 * <code title="Commenting out fluid code">
29 * Before
30 * <f:comment>
31 * This is completely hidden.
32 * <f:debug>This does not get parsed</f:debug>
33 * </f:comment>
34 * After
35 * </code>
36 * <output>
37 * Before
38 * After
39 * </output>
40 *
41 * <code title="Prevent parsing">
42 * <f:comment><![CDATA[
43 * <f:some.invalid.syntax />
44 * ]]></f:comment>
45 * </code>
46 * <output>
47 * </output>
48 *
49 * @api
50 */
51 class CommentViewHelper extends AbstractViewHelper implements CompilableInterface {
52
53 /**
54 * @var bool
55 */
56 protected $escapingInterceptorEnabled = FALSE;
57
58 /**
59 * Comments out the tag content
60 *
61 * @return string
62 * @api
63 */
64 public function render() {
65 return '';
66 }
67
68 /**
69 * The inner contents of a comment should not be rendered.
70 *
71 * @param string $argumentsVariableName
72 * @param string $renderChildrenClosureVariableName
73 * @param string $initializationPhpCode
74 * @param \TYPO3\CMS\Fluid\Core\Parser\SyntaxTree\AbstractNode $syntaxTreeNode
75 * @param \TYPO3\CMS\Fluid\Core\Compiler\TemplateCompiler $templateCompiler
76 * @return string
77 */
78 public function compile($argumentsVariableName, $renderChildrenClosureVariableName, &$initializationPhpCode, AbstractNode $syntaxTreeNode, TemplateCompiler $templateCompiler) {
79 return '\'\'';
80 }
81
82 }