‪TYPO3CMS  10.4
HtmlViewHelper.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4  * This file is part of the TYPO3 CMS project.
5  *
6  * It is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU General Public License, either version 2
8  * of the License, or any later version.
9  *
10  * For the full copyright and license information, please read the
11  * LICENSE.txt file that was distributed with this source code.
12  *
13  * The TYPO3 project - inspiring people to share!
14  */
15 
17 
22 use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
23 use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
24 use TYPO3Fluid\Fluid\Core\ViewHelper\Traits\CompileWithRenderStatic;
25 
71 class ‪HtmlViewHelper extends AbstractViewHelper
72 {
73  use CompileWithRenderStatic;
74 
78  protected static ‪$tsfeBackup;
79 
85  protected ‪$escapeChildren = false;
86 
92  protected ‪$escapeOutput = false;
93 
99  public function ‪initializeArguments()
100  {
101  $this->registerArgument('parseFuncTSPath', 'string', 'Path to TypoScript parseFunc setup', false, 'lib.parseFunc_RTE');
102  }
103 
111  public static function ‪renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
112  {
113  $parseFuncTSPath = $arguments['parseFuncTSPath'];
114  if (TYPO3_MODE === 'BE') {
116  }
117  $value = $renderChildrenClosure();
118  $contentObject = GeneralUtility::makeInstance(ContentObjectRenderer::class);
119  $contentObject->start([]);
120  $content = $contentObject->parseFunc($value, [], '< ' . $parseFuncTSPath);
121  if (TYPO3_MODE === 'BE') {
123  }
124  return $content;
125  }
126 
131  protected static function ‪simulateFrontendEnvironment()
132  {
133  self::$tsfeBackup = ‪$GLOBALS['TSFE'] ?? null;
134  ‪$GLOBALS['TSFE'] = new \stdClass();
135  ‪$GLOBALS['TSFE']->tmpl = new \stdClass();
136  $objectManager = GeneralUtility::makeInstance(ObjectManager::class);
137  $configurationManager = $objectManager->get(ConfigurationManagerInterface::class);
138  ‪$GLOBALS['TSFE']->tmpl->setup = $configurationManager->getConfiguration(‪ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT);
139  }
140 
146  protected static function ‪resetFrontendEnvironment()
147  {
149  }
150 }
‪TYPO3\CMS\Fluid\ViewHelpers\Format\HtmlViewHelper\resetFrontendEnvironment
‪static resetFrontendEnvironment()
Definition: HtmlViewHelper.php:142
‪TYPO3\CMS\Fluid\ViewHelpers\Format\HtmlViewHelper\initializeArguments
‪initializeArguments()
Definition: HtmlViewHelper.php:95
‪TYPO3\CMS\Fluid\ViewHelpers\Format\HtmlViewHelper\renderStatic
‪static string renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
Definition: HtmlViewHelper.php:107
‪TYPO3\CMS\Fluid\ViewHelpers\Format\HtmlViewHelper
Definition: HtmlViewHelper.php:72
‪TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface
Definition: ConfigurationManagerInterface.php:28
‪TYPO3\CMS\Fluid\ViewHelpers\Format\HtmlViewHelper\$escapeOutput
‪bool $escapeOutput
Definition: HtmlViewHelper.php:88
‪TYPO3\CMS\Fluid\ViewHelpers\Format\HtmlViewHelper\$tsfeBackup
‪static TYPO3 CMS Frontend Controller TypoScriptFrontendController $tsfeBackup
Definition: HtmlViewHelper.php:76
‪TYPO3\CMS\Fluid\ViewHelpers\Format\HtmlViewHelper\simulateFrontendEnvironment
‪static simulateFrontendEnvironment()
Definition: HtmlViewHelper.php:127
‪TYPO3\CMS\Fluid\ViewHelpers\Format
Definition: AbstractEncodingViewHelper.php:16
‪TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface\CONFIGURATION_TYPE_FULL_TYPOSCRIPT
‪const CONFIGURATION_TYPE_FULL_TYPOSCRIPT
Definition: ConfigurationManagerInterface.php:31
‪$GLOBALS
‪$GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['adminpanel']['modules']
Definition: ext_localconf.php:5
‪TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer
Definition: ContentObjectRenderer.php:97
‪TYPO3\CMS\Fluid\ViewHelpers\Format\HtmlViewHelper\$escapeChildren
‪bool $escapeChildren
Definition: HtmlViewHelper.php:82
‪TYPO3\CMS\Core\Utility\GeneralUtility
Definition: GeneralUtility.php:46
‪TYPO3\CMS\Extbase\Object\ObjectManager
Definition: ObjectManager.php:28