‪TYPO3CMS  ‪main
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 final class ‪SubModuleRenderViewHelper extends AbstractViewHelper
33 {
34  use CompileWithRenderStatic;
35 
36  public function ‪initializeArguments(): void
37  {
38  $this->registerArgument('module', ContentProviderInterface::class, 'SubModule instance to be rendered', true);
39  $this->registerArgument('data', ModuleDataStorageCollection::class, 'Data to be used for rendering', true);
40  }
41 
47  public static function ‪renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext): string
48  {
49  $module = $arguments['module'];
50  $data = $arguments['data'];
51  $moduleData = $data->contains($module) ? $data->offsetGet($module) : new ‪ModuleData();
52  return $module->getContent($moduleData);
53  }
54 }
‪TYPO3\CMS\Adminpanel\ModuleApi\ModuleDataStorageCollection
Definition: ModuleDataStorageCollection.php:24
‪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:35
‪TYPO3\CMS\Adminpanel\ModuleApi\ModuleData
Definition: ModuleData.php:26
‪TYPO3\CMS\Adminpanel\ViewHelpers\SubModuleRenderViewHelper
Definition: SubModuleRenderViewHelper.php:33
‪TYPO3\CMS\Adminpanel\ViewHelpers\SubModuleRenderViewHelper\renderStatic
‪static renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
Definition: SubModuleRenderViewHelper.php:46