CropViewHelper extends AbstractViewHelper uses CompileWithRenderStatic

ViewHelper

This class is the implementation of a Fluid ViewHelper.

View this class in the TYPO3 ViewHelper reference: <f:format.crop>

FinalYes

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

Whitespace within the f:format.crop element will be considered as characters.

Examples

Defaults

::

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

This is...

The third word "some" does not fit in the 10 character limit, because respectWordBoundaries is true by default.

Custom suffix

::

<f:format.crop maxCharacters="17" append=" [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 s...

Don't respect HTML tags

::

<f:format.crop maxCharacters="28" respectWordBoundaries="false" respectHtml="false"> This is some text with HTML 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}.

Table of Contents

Properties

$escapeOutput  : bool
The output may contain HTML and can not be escaped.

Methods

initializeArguments()  : void
renderStatic()  : string

Properties

$escapeOutput

The output may contain HTML and can not be escaped.

protected bool $escapeOutput = false

Methods

initializeArguments()

public initializeArguments() : void

renderStatic()

public static renderStatic(array<string|int, mixed> $arguments, Closure $renderChildrenClosure, RenderingContextInterface $renderingContext) : string
Parameters
$arguments : array<string|int, mixed>
$renderChildrenClosure : Closure
$renderingContext : RenderingContextInterface
Return values
string

        
On this page

Search results