format.crop

Use this view helper to crop the text between its opening and closing tags.

Examples

Defaults:

<f:format.crop maxCharacters="10">This is some very long text</f:format.crop>

This is

Custom suffix:

<f:format.crop maxCharacters="17" append="&nbsp;[more]">This is some very long text</f:format.crop>

This is some&nbsp;[more]

Don’t respect word boundaries:

<f:format.crop maxCharacters="10" respectWordBoundaries="false">This is some very long text</f:format.crop>

This is so

Don’t respect HTML tags:

<f:format.crop maxCharacters="28" respectWordBoundaries="false" respectHtml="false">This is some text with <strong>HTML</strong> tags</f:format.crop>

This is some text with <stro

Inline notation:

{someLongText -> f:format.crop(maxCharacters: 10)}

someLongText cropped after 10 characters (depending on the value of {someLongText})

Arguments

maxCharacters (anySimpleType)

Place where to truncate the string

append (string)

Default: &#039;&amp;hellip;&#039;

What to append, if truncation happened

respectWordBoundaries (anySimpleType)

Default: true

If TRUE and division is in the middle of a word, the remains of that word is removed.

respectHtml (anySimpleType)

Default: true

If TRUE the cropped string will respect HTML tags and entities. Technically that means, that cropHTML() is called rather than crop()