BytesViewHelper extends AbstractViewHelper uses CompileWithContentArgumentAndRenderStatic

ViewHelper

This class is the implementation of a Fluid ViewHelper.

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

FinalYes

Formats an integer with a byte count into human readable form.

Examples

Simple

::

{fileSize -> f:format.bytes()}

123 KB Depending on the value of {fileSize}.

With arguments

::

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

1,023.00 B Depending on the value of {fileSize}.

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

Custom units

::

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

123 KB Depending on the value of {fileSize}.

Table of Contents

Properties

$escapeChildren  : bool
Output is escaped already. We must not escape children, to avoid double encoding.

Methods

initializeArguments()  : void
renderStatic()  : string
Render the supplied byte count as a human-readable string.
resolveContentArgumentName()  : string
Explicitly set argument name to be used as content.

Properties

$escapeChildren

Output is escaped already. We must not escape children, to avoid double encoding.

protected bool $escapeChildren = false

Methods

initializeArguments()

public initializeArguments() : void

renderStatic()

Render the supplied byte count as a human-readable string.

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

resolveContentArgumentName()

Explicitly set argument name to be used as content.

public resolveContentArgumentName() : string
Return values
string

        
On this page

Search results