Skip to content
This repository has been archived by the owner on Feb 25, 2023. It is now read-only.

Commit

Permalink
Update format ViewHelper
Browse files Browse the repository at this point in the history
  • Loading branch information
michadu committed Apr 17, 2017
1 parent e043007 commit d18da27
Show file tree
Hide file tree
Showing 19 changed files with 361 additions and 278 deletions.
7 changes: 7 additions & 0 deletions Documentation/Fluid/ViewHelper/Format/AbstractEncoding.rst
@@ -0,0 +1,7 @@
.. include:: ../../../Includes.txt

AbstractEncoding
================

This is the base class for ViewHelpers that work with encodings.
Currently that are format.htmlentities and format.htmlentitiesDecode.
44 changes: 41 additions & 3 deletions Documentation/Fluid/ViewHelper/Format/Bytes.rst
Expand Up @@ -51,7 +51,7 @@ decimalSeparator
No

thousandsSeparator
~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~
:aspect:`Variable type`
String

Expand All @@ -64,8 +64,22 @@ thousandsSeparator
:aspect:`Mandatory`
No

Example
-------
units
~~~~~
:aspect:`Variable type`
String

:aspect:`Description`
Comma separated list of available units.

:aspect:`Default value`
LocalizationUtility::translate('viewhelper.format.bytes.units', 'fluid')

:aspect:`Mandatory`
No

Examples
--------

With a value of 1024.33, using the code

Expand All @@ -78,3 +92,27 @@ will output
::

1024 KB

With decimal and thousands separator

::

{fileSize -> f:format.bytes(decimals: 2, decimalSeparator: '.', thousandsSeparator: ',')}

will output

::

1,023.00 B

You may provide an own set of units, like this: B,KB,MB,GB,TB,PB,EB,ZB,YB

::

{fileSize -> f:format.bytes(units: '{f:translate(\'viewhelper.format.bytes.units\', \'fluid\')}'

will output

::

123 KB
77 changes: 77 additions & 0 deletions Documentation/Fluid/ViewHelper/Format/Case.rst
@@ -0,0 +1,77 @@
.. include:: ../../../Includes.txt

f:format.case
=============

Modifies the case of an input string to upper- or lowercase or capitalization.

The default transformation will be uppercase as in `mb_convert_case` [http://php.net/manual/function.mb-convert-case.php].

Note that the behavior will be the same as in the appropriate PHP function `mb_convert_case`;
especially regarding locale and multibyte behavior.

Properties
----------

value
~~~~~
:aspect:`Variable type`
String

:aspect:`Description`
The input value. If not given, the evaluated child nodes will be used.

:aspect:`Default value`
NULL

:aspect:`Mandatory`
No

mode
~~~~
:aspect:`Variable type`
String

:aspect:`Description`
The case to apply, must be one of this' CASE_* constants. Defaults to uppercase application.
Possible modes are:

`CASE_LOWER = 'lower'`
Transforms the input string to its lowercase representation

`CASE_UPPER = 'upper'`
Transforms the input string to its uppercase representation

`CASE_CAPITAL = 'capital`
Transforms the input string to its first letter upper-cased, i.e. capitalization

`CASE_UNCAPITAL = 'uncapital'`
Transforms the input string to its first letter lower-cased, i.e. uncapitalization

`CASE_CAPITAL_WORDS = 'capitalWords'`
Not supported yet: Transforms the input string to each containing word being capitalized

:aspect:`Default value`
self::CASE_UPPER

:aspect:`Mandatory`
No

Examples
--------

Some Text with mixed case

::

<f:format.case>Some Text with miXed case</f:format.case>

SOME TEXT WITH MIXED CASE

Example with given mode

::

<f:format.case mode="capital">someString</f:format.case>

SomeString
68 changes: 0 additions & 68 deletions Documentation/Fluid/ViewHelper/Format/Cdata.rst

This file was deleted.

10 changes: 10 additions & 0 deletions Documentation/Fluid/ViewHelper/Format/Crop.rst
Expand Up @@ -26,6 +26,11 @@ append
:aspect:`Description`
A string to be appended to the cropped text.

:aspect:`Default`
...

:aspect:`Required`
No

respectWordBoundaries
---------------------
Expand All @@ -41,6 +46,8 @@ respectWordBoundaries
:aspect:`Default`
True

:aspect:`Required`
No

respectHtml
-----------
Expand All @@ -56,6 +63,9 @@ respectHtml
:aspect:`Default`
True

:aspect:`Required`
No


Examples
--------
Expand Down
4 changes: 2 additions & 2 deletions Documentation/Fluid/ViewHelper/Format/Currency.rst
Expand Up @@ -113,7 +113,7 @@ Examples

<f:format.currency currencySign="€" decimalSeparator="." thousandsSeparator="," prependCurrency="true">1122334455.66</f:format.currency>

produces: € 1,122,334,455.66
produces: `€ 1,122,334,455.66

Non-float value
~~~~~~~~~~~~~~~
Expand All @@ -122,4 +122,4 @@ Non-float value

<f:format.currency currencySign="€" decimalSeparator="." thousandsSeparator="," prependCurrency="true">1122334455,66</f:format.currency>

produces: `€ 1,122,334,455.00`
produces: `€ 1,122,334,455.00`
6 changes: 4 additions & 2 deletions Documentation/Fluid/ViewHelper/Format/Html.rst
Expand Up @@ -6,7 +6,9 @@ f:format.html
When you've created a Model for the `tt_content` table, data that you receive for the front end is raw and
unformatted: just as it's stored in the database. So that you can parse this data and output it as you would by
using `styles.content.get` in TypoScript, you can use this ViewHelper. It takes the unformatted content and runs it
through the `lib.parseFunc_RTE` parser, providing you with the formatted output you need.
through a parser, providing you with the formatted output you need.
You can either specify a path to the TypoScript setting or set the parseFunc options directly.
By default `lib.parseFunc_RTE` is used to parse the string.

Properties
----------
Expand Down Expand Up @@ -39,4 +41,4 @@ This specific alternative will format the text in the variable without passing i

::

<f:format.html parseFuncTSPath="lib.parseFunc">{variable}</f:format.html>
<f:format.html parseFuncTSPath="lib.parseFunc">{variable}</f:format.html>
13 changes: 7 additions & 6 deletions Documentation/Fluid/ViewHelper/Format/Htmlentities.rst
Expand Up @@ -3,7 +3,8 @@
f:format.htmlentities
=====================

Mit diesem ViewHelper könnt Ihr die htmlentities Funktion von PHP auf einen Text anwenden.
Escapes special characters with their escaped counterparts as needed using PHPs htmlentities() function.
http://www.php.net/manual/function.htmlentities.php

Properties
----------
Expand All @@ -14,7 +15,7 @@ value
String

:aspect:`Description`
Der Text der dekodiert werden soll
String to format.

:aspect:`Default value`
NULL
Expand All @@ -28,7 +29,7 @@ keepQuotes
Boolean

:aspect:`Description`
Sollen einfache und doppelte Anführungsstriche auch dekodiert werden?
If TRUE, single and double quotes won't be replaced (sets ENT_NOQUOTES flag).

:aspect:`Default value`
FALSE
Expand All @@ -42,7 +43,7 @@ encoding
String

:aspect:`Description`
Wir sind hier im Bereich TYPO3 und da sollte der Zeichensatz auf UTF-8 und nix anderes stehen. Sollte wiedererwartend ein anderer Zeichensatz gewünscht sein, kann dieser hier angegeben werden. Siehe auch Info auf php.net.
Generally TYPO3 uses the UTF-8 charset. But if you need an other charset for a special case, you can enter it here.

:aspect:`Default value`
NULL
Expand All @@ -56,7 +57,7 @@ doubleEncode
Boolean

:aspect:`Description`
Bei TRUE (Standard) wird alles kodiert. Bei FALSE, werden bereits kodierte Werte nicht erneut kodiert.
If FALSE existing html entities won't be encoded, the default is to convert everything.

:aspect:`Default value`
TRUE
Expand All @@ -73,4 +74,4 @@ Beispiel

::

M&uuml;ller &amp; Breuer
M&uuml;ller &amp; Breuer
15 changes: 8 additions & 7 deletions Documentation/Fluid/ViewHelper/Format/HtmlentitiesDecode.rst
Expand Up @@ -3,7 +3,8 @@
f:format.htmlentitiesDecode
===========================

htmlEntityDecode
Applies html_entity_decode() to a value.
http://www.php.net/html_entity_decode

Properties
----------
Expand All @@ -14,7 +15,7 @@ value
String

:aspect:`Description`
Der Text der dekodiert werden soll
String to format.

:aspect:`Default value`
NULL
Expand All @@ -28,7 +29,7 @@ keepQuotes
Boolean

:aspect:`Description`
Sollen einfache und doppelte Anführungsstriche auch dekodiert werden?
If TRUE, single and double quotes won't be replaced (sets ENT_NOQUOTES flag).

:aspect:`Default value`
FALSE
Expand All @@ -42,19 +43,19 @@ encoding
String

:aspect:`Description`
Wir sind hier im Bereich TYPO3 und da sollte der Zeichensatz auf UTF-8 und nix anderes stehen. Sollte wiedererwartend ein anderer Zeichensatz gewünscht sein, kann dieser hier angegeben werden. Siehe auch Info auf php.net.
Generally TYPO3 uses the UTF-8 charset. But if you need an other charset for a special case, you can enter it here.

:aspect:`Default value`
NULL

:aspect:`Mandatory`
No

Beispiel
--------
Example
-------

::

<p><f:format.htmlentitiesDecode>M&uuml;ller &amp; Breuer</f:format.htmlentitiesDecode>

Im Quelltext sieht man wieder ein richtig sauberes: "Müller & Breuer".
In the HTML source code you can see a clean: "Müller & Breuer".

0 comments on commit d18da27

Please sign in to comment.