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