‪TYPO3CMS  10.4
TYPO3\CMS\Fluid\ViewHelpers\Format\CropViewHelper Class Reference
Inheritance diagram for TYPO3\CMS\Fluid\ViewHelpers\Format\CropViewHelper:

Public Member Functions

 initializeArguments ()
 

Static Public Member Functions

static string renderStatic (array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
 

Protected Attributes

bool $escapeOutput = false
 

Detailed Description

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="&nbsp;[more]"> This is some very long text </f:format.crop>

This is some [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}.

Definition at line 89 of file CropViewHelper.php.

Member Function Documentation

◆ initializeArguments()

TYPO3\CMS\Fluid\ViewHelpers\Format\CropViewHelper::initializeArguments ( )

Initialize arguments.

Exceptions

Definition at line 103 of file CropViewHelper.php.

◆ renderStatic()

static string TYPO3\CMS\Fluid\ViewHelpers\Format\CropViewHelper::renderStatic ( array  $arguments,
\Closure  $renderChildrenClosure,
RenderingContextInterface  $renderingContext 
)
static
Parameters
array$arguments
\Closure$renderChildrenClosure
RenderingContextInterface$renderingContext
Returns
‪string
Exceptions

Definition at line 119 of file CropViewHelper.php.

Member Data Documentation

◆ $escapeOutput

bool TYPO3\CMS\Fluid\ViewHelpers\Format\CropViewHelper::$escapeOutput = false
protected

The output may contain HTML and can not be escaped.

Definition at line 96 of file CropViewHelper.php.