[TASK] Make ViewHelpers compilable in ext:extensionmanager
[Packages/TYPO3.CMS.git] / typo3 / sysext / extensionmanager / Classes / ViewHelpers / Format / ImplodeViewHelper.php
1 <?php
2 namespace TYPO3\CMS\Extensionmanager\ViewHelpers\Format;
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
17 use TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper;
18 use TYPO3\CMS\Fluid\Core\Rendering\RenderingContextInterface;
19 use TYPO3\CMS\Fluid\Core\ViewHelper\Facets\CompilableInterface;
20
21 /**
22 * View Helper for imploding arrays
23 *
24 * @author Susanne Moog <typo3@susannemoog.de>
25 * @internal
26 */
27 class ImplodeViewHelper extends AbstractViewHelper implements CompilableInterface {
28
29 /**
30 * Implodes a string
31 *
32 * @param array $implode
33 * @param string $delimiter
34 * @return string the altered string.
35 * @api
36 */
37 public function render(array $implode, $delimiter = ', ') {
38 return self::renderStatic(
39 array(
40 'implode' => $implode,
41 'delimiter' => $delimiter,
42 ),
43 $this->buildRenderChildrenClosure(),
44 $this->renderingContext
45 );
46 }
47
48 /**
49 * @param array $arguments
50 * @param callable $renderChildrenClosure
51 * @param RenderingContextInterface $renderingContext
52 *
53 * @return string
54 */
55 static public function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext) {
56 return implode($arguments['delimiter'], $arguments['implode']);
57 }
58
59 }