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