Revert "[FEATURE] Introduce ImplodeViewHelper" 94/43394/2
authorBenni Mack <benni@typo3.org>
Thu, 17 Sep 2015 11:53:31 +0000 (13:53 +0200)
committerGeorg Ringer <georg.ringer@gmail.com>
Thu, 17 Sep 2015 12:21:13 +0000 (14:21 +0200)
The ViewHelper is not needed anymore, as the new content elements
based on Fluid are simplified.

This reverts commit 3194169a767294d7ce1a187e2dfe508bb1713b47.

Change-Id: I301383d17a49972e949dcc662dfecd39580bcaeb
Reviewed-on: http://review.typo3.org/43394
Reviewed-by: Frans Saris <franssaris@gmail.com>
Tested-by: Frans Saris <franssaris@gmail.com>
Reviewed-by: Mathias Schreiber <mathias.schreiber@wmdb.de>
Tested-by: Mathias Schreiber <mathias.schreiber@wmdb.de>
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
typo3/sysext/core/Documentation/Changelog/master/Feature-68538-IntroducedImplodeViewHelper.rst [deleted file]
typo3/sysext/frontend/Classes/ViewHelpers/Format/ImplodeViewHelper.php [deleted file]
typo3/sysext/frontend/Tests/Functional/ViewHelpers/Format/ImplodeViewHelperTest.php [deleted file]

diff --git a/typo3/sysext/core/Documentation/Changelog/master/Feature-68538-IntroducedImplodeViewHelper.rst b/typo3/sysext/core/Documentation/Changelog/master/Feature-68538-IntroducedImplodeViewHelper.rst
deleted file mode 100644 (file)
index 2963493..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-==============================================
-Feature: #68538 - Introduced ImplodeViewHelper
-==============================================
-
-Description
-===========
-
-To be able to glue a array of strings together (f.i. to build a class attribute value) the ``f:format.implode`` ViewHelper is added.
-
-ViewHelper parameters:
-- array $values: array of elements to join
-- string $glue: String used as glue between elements (default: space)
-- bool $excludeEmptyValues: Remove empty elements (default: TRUE)
-
-
-Examples
-========
-
-Some examples of using ``fe:format.implode``:
-
-.. code-block:: html
-
-    <fe:format.implode values="{0: 'className-1', 1: 'className-2'}" />
-
-Output: ``className-1 className-2``
-
-
-.. code-block:: html
-
-    <div class="{fe:format.implode(values:'{0:\'className-1\', 1:\'className-2\'}')}">Foo</div>
-
-Output: ``<div class="className-1 className-2">Foo</div>``
\ No newline at end of file
diff --git a/typo3/sysext/frontend/Classes/ViewHelpers/Format/ImplodeViewHelper.php b/typo3/sysext/frontend/Classes/ViewHelpers/Format/ImplodeViewHelper.php
deleted file mode 100644 (file)
index 4652bca..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-<?php
-namespace TYPO3\CMS\Frontend\ViewHelpers\Format;
-
-/*
- * This file is part of the TYPO3 CMS project.
- *
- * It is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License, either version 2
- * of the License, or any later version.
- *
- * For the full copyright and license information, please read the
- * LICENSE.txt file that was distributed with this source code.
- *
- * The TYPO3 project - inspiring people to share!
- */
-
-use TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper;
-use TYPO3\CMS\Fluid\Core\Rendering\RenderingContextInterface;
-use TYPO3\CMS\Fluid\Core\ViewHelper\Facets\CompilableInterface;
-
-/**
- * A view helper which joins array elements with a glue string.
- *
- * = Examples =
- *
- * <code>
- *   class="<f:format.implode values="{0: 'className-1', 1: 'className-2'}" />"
- * </code>
- *
- * <output>
- *   class="className-1 className-2"
- * </output>
- *
- * <code>
- *   class="{f:format.implode(values:'{0:\'className-1\', 1:\'className-2\'}')}"
- * </code>
- *
- * <output>
- *   class="className-1 className-2"
- * </output>
- *
- * <code>
- *   class="<f:format.implode values="{0: 'prefix', 1: 'value1', 2: 'value2'}" glue="-" />"
- * </code>
- *
- * <output>
- *   class="prefix-value1-value2"
- * </output>
- */
-class ImplodeViewHelper extends AbstractViewHelper implements CompilableInterface {
-
-       /**
-        * Render the view helper
-        *
-        * @param array $values array of elements to join
-        * @param string $glue String used as glue between elements
-        * @param bool $excludeEmptyValues Remove empty elements from $values
-        * @return string
-        */
-       public function render(array $values, $glue = ', ', $excludeEmptyValues = TRUE) {
-               return self::renderStatic(
-                       array(
-                               'values' => $values,
-                               'glue' => $glue,
-                               'excludeEmptyValues' => $excludeEmptyValues
-                       ),
-                       $this->buildRenderChildrenClosure(),
-                       $this->renderingContext
-               );
-       }
-
-       /**
-        * @param array $arguments
-        * @param \Closure $renderChildrenClosure
-        * @param RenderingContextInterface $renderingContext
-        * @return string
-        */
-       static public function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext) {
-               $values = (array)$arguments['values'];
-               if (empty($values)) {
-                       $values =(array)$renderChildrenClosure();
-               }
-               $glue = $arguments['glue'];
-               $excludeEmptyValues = (bool)$arguments['excludeEmptyValues'];
-               $string = '';
-
-               if ($excludeEmptyValues) {
-                       $values = array_filter($values);
-               }
-               if (!empty($values)) {
-                       $string = implode($glue, $values);
-               }
-               return $string;
-       }
-}
\ No newline at end of file
diff --git a/typo3/sysext/frontend/Tests/Functional/ViewHelpers/Format/ImplodeViewHelperTest.php b/typo3/sysext/frontend/Tests/Functional/ViewHelpers/Format/ImplodeViewHelperTest.php
deleted file mode 100644 (file)
index b0a5f6f..0000000
+++ /dev/null
@@ -1,88 +0,0 @@
-<?php
-namespace TYPO3\CMS\Frontend\Tests\Functional\ViewHelpers\Format;
-
-/*
- * This file is part of the TYPO3 CMS project.
- *
- * It is free software; you can redistribute it and/or modify it under
- * the terms of the GNU General Public License, either version 2
- * of the License, or any later version.
- *
- * For the full copyright and license information, please read the
- * LICENSE.txt file that was distributed with this source code.
- *
- * The TYPO3 project - inspiring people to share!
- */
-use TYPO3\CMS\Fluid\Tests\Unit\ViewHelpers\ViewHelperBaseTestcase;
-use TYPO3\CMS\Frontend\ViewHelpers\Format\ImplodeViewHelper;
-
-/**
- * Class ImplodeViewHelperTest
- */
-class ImplodeViewHelperTest extends ViewHelperBaseTestcase {
-
-       /**
-        * @var ImplodeViewHelper|\PHPUnit_Framework_MockObject_MockObject
-        */
-       protected $subject;
-
-       protected function setUp() {
-               parent::setUp();
-               $this->subject = $this->getMock(ImplodeViewHelper::class, array('renderChildren'));
-               $this->injectDependenciesIntoViewHelper($this->subject);
-       }
-
-       /**
-        * @return array
-        */
-       public function implodeDataProvider() {
-               return [
-                       'Join elements with space' => [
-                               ['class-a', 'class-b', 'class-c'],
-                               ' ',
-                               TRUE,
-                               'class-a class-b class-c'
-                       ],
-                       'Join elements with space excluding empty values' => [
-                               ['class-a', 'class-b', '', 'class-d'],
-                               ' ',
-                               TRUE,
-                               'class-a class-b class-d'
-                       ],
-                       'Join elements with space including empty values' => [
-                               ['class-a', 'class-b', '', 'class-d'],
-                               ' ',
-                               FALSE,
-                               'class-a class-b  class-d'
-                       ],
-                       'Join elements with /' => [
-                               ['class-a', 'class-b', 'class-c'],
-                               '/',
-                               TRUE,
-                               'class-a/class-b/class-c'
-                       ],
-                       'Join elements with / excluding empty values' => [
-                               ['class-a', 'class-b', '', 'class-d'],
-                               '/',
-                               TRUE,
-                               'class-a/class-b/class-d'
-                       ],
-                       'Join elements with / including empty values' => [
-                               ['class-a', 'class-b', '', 'class-d'],
-                               '/',
-                               FALSE,
-                               'class-a/class-b//class-d'
-                       ],
-               ];
-       }
-
-       /**
-        * @test
-        * @dataProvider implodeDataProvider
-        */
-       public function ImplodeViewHelperOutputTest($values, $glue, $excludeEmptyValues, $expectedResult) {
-               $actualResult = $this->subject->render($values, $glue, $excludeEmptyValues);
-               $this->assertEquals($expectedResult, $actualResult);
-       }
-
-}
\ No newline at end of file