‪TYPO3CMS  10.4
RenderAllFormValuesViewHelper.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 
18 /*
19  * Inspired by and partially taken from the Neos.Form package (www.neos.io)
20  */
21 
23 
26 use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
27 use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
28 use TYPO3Fluid\Fluid\Core\ViewHelper\Traits\CompileWithRenderStatic;
29 
35 class ‪RenderAllFormValuesViewHelper extends AbstractViewHelper
36 {
37  use CompileWithRenderStatic;
38 
42  protected ‪$escapeOutput = false;
43 
49  public function ‪initializeArguments()
50  {
51  $this->registerArgument('renderable', RootRenderableInterface::class, 'A RootRenderableInterface instance', true);
52  $this->registerArgument('as', 'string', 'The name within the template', false, 'formValue');
53  }
54 
63  public static function ‪renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
64  {
65  $renderable = $arguments['renderable'];
66 
67  if ($renderable instanceof ‪CompositeRenderableInterface) {
68  $elements = $renderable->getRenderablesRecursively();
69  } else {
70  $elements = [$renderable];
71  }
72 
73  $as = $arguments['as'];
74  ‪$output = '';
75 
76  foreach ($elements as $element) {
78  [
79  'renderable' => $element,
80  'as' => $as,
81  ],
82  $renderChildrenClosure,
83  $renderingContext
84  );
85  }
86 
87  return ‪$output;
88  }
89 }
‪TYPO3\CMS\Form\ViewHelpers\RenderAllFormValuesViewHelper
Definition: RenderAllFormValuesViewHelper.php:36
‪TYPO3\CMS\Form\ViewHelpers\RenderAllFormValuesViewHelper\renderStatic
‪static string renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
Definition: RenderAllFormValuesViewHelper.php:61
‪TYPO3\CMS\Form\ViewHelpers\RenderAllFormValuesViewHelper\$escapeOutput
‪bool $escapeOutput
Definition: RenderAllFormValuesViewHelper.php:40
‪TYPO3\CMS\Form\ViewHelpers\RenderAllFormValuesViewHelper\initializeArguments
‪initializeArguments()
Definition: RenderAllFormValuesViewHelper.php:47
‪TYPO3\CMS\Form\Domain\Model\Renderable\RootRenderableInterface
Definition: RootRenderableInterface.php:31
‪TYPO3\CMS\Form\ViewHelpers\RenderFormValueViewHelper\renderStatic
‪static string renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
Definition: RenderFormValueViewHelper.php:64
‪$output
‪$output
Definition: annotationChecker.php:119
‪TYPO3\CMS\Form\ViewHelpers
‪TYPO3\CMS\Form\Domain\Model\Renderable\CompositeRenderableInterface
Definition: CompositeRenderableInterface.php:32