Feature-68538-IntroducedImplodeViewHelper.rst 881 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
==============================================
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>``