.. include:: /Includes.rst.txt
.. _typo3-fluid-format-crop:
===========
format.crop
===========
Use this ViewHelper to crop the text between its opening and closing tags.
Examples
========
Defaults
--------
::
This is some very long text
``This is``
Custom suffix
-------------
::
This is some very long text
``This is some [more]``
Don't respect word boundaries
-----------------------------
::
This is some very long text
``This is so``
Don't respect HTML tags
-----------------------
::
This is some text with HTML tags
``This is some text with f:format.crop(maxCharacters: 10)}
``someLongText cropped after 10 characters``
Depending on the value of ``{someLongText}``.
Arguments
=========
.. _format.crop_maxcharacters:
maxCharacters
-------------
:aspect:`DataType`
mixed
:aspect:`Required`
false
:aspect:`Description`
Place where to truncate the string
.. _format.crop_append:
append
------
:aspect:`DataType`
string
:aspect:`Default`
'…'
:aspect:`Required`
false
:aspect:`Description`
What to append, if truncation happened
.. _format.crop_respectwordboundaries:
respectWordBoundaries
---------------------
:aspect:`DataType`
mixed
:aspect:`Default`
true
:aspect:`Required`
false
:aspect:`Description`
If TRUE and division is in the middle of a word, the remains of that word is removed.
.. _format.crop_respecthtml:
respectHtml
-----------
:aspect:`DataType`
mixed
:aspect:`Default`
true
:aspect:`Required`
false
:aspect:`Description`
If TRUE the cropped string will respect HTML tags and entities. Technically that means, that cropHTML() is called rather than crop()