‪TYPO3CMS  10.4
SubModuleRenderViewHelper.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
19 
23 use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
24 use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
25 use TYPO3Fluid\Fluid\Core\ViewHelper\Traits\CompileWithRenderStatic;
26 
32 class ‪SubModuleRenderViewHelper extends AbstractViewHelper
33 {
34  use CompileWithRenderStatic;
35 
41  protected static ‪$usernameRuntimeCache = [];
42 
46  public function ‪initializeArguments(): void
47  {
48  $this->registerArgument(
49  'module',
50  ContentProviderInterface::class,
51  'SubModule instance to be rendered',
52  true
53  );
54  $this->registerArgument('data', ModuleDataStorageCollection::class, 'Data to be used for rendering', true);
55  }
56 
65  public static function ‪renderStatic(
66  array $arguments,
67  \Closure $renderChildrenClosure,
68  RenderingContextInterface $renderingContext
69  ): string {
70  $module = $arguments['module'];
72  $data = $arguments['data'];
73  $moduleData = $data->contains($module) ? $data->offsetGet($module) : new ‪ModuleData();
74  return $module->getContent($moduleData);
75  }
76 }
‪TYPO3\CMS\Adminpanel\ModuleApi\ModuleDataStorageCollection
Definition: ModuleDataStorageCollection.php:24
‪TYPO3\CMS\Adminpanel\ViewHelpers\SubModuleRenderViewHelper\renderStatic
‪static string renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
Definition: SubModuleRenderViewHelper.php:63
‪TYPO3\CMS\Adminpanel\ViewHelpers\SubModuleRenderViewHelper\$usernameRuntimeCache
‪static array $usernameRuntimeCache
Definition: SubModuleRenderViewHelper.php:39
‪TYPO3\CMS\Adminpanel\ModuleApi\ContentProviderInterface
Definition: ContentProviderInterface.php:30
‪TYPO3\CMS\Adminpanel\ViewHelpers
Definition: IsArrayViewHelper.php:18
‪TYPO3\CMS\Adminpanel\ViewHelpers\SubModuleRenderViewHelper\initializeArguments
‪initializeArguments()
Definition: SubModuleRenderViewHelper.php:44
‪TYPO3\CMS\Adminpanel\ModuleApi\ModuleData
Definition: ModuleData.php:27
‪TYPO3\CMS\Adminpanel\ViewHelpers\SubModuleRenderViewHelper
Definition: SubModuleRenderViewHelper.php:33