17 use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
18 use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
19 use TYPO3Fluid\Fluid\Core\ViewHelper\Traits\CompileWithContentArgumentAndRenderStatic;
61 use CompileWithContentArgumentAndRenderStatic;
77 $this->registerArgument(
'value',
'string',
'string to format');
78 $this->registerArgument(
'padLength',
'int',
'Length of the resulting string. If the value of pad_length is negative or less than the length of the input string, no padding takes place.',
true);
79 $this->registerArgument(
'padString',
'string',
'The padding string',
false,
' ');
80 $this->registerArgument(
'padType',
'string',
'Append the padding at this site (Possible values: right,left,both. Default: right)',
false,
'right');
91 public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext)
93 $value = $renderChildrenClosure();
95 'left' => STR_PAD_LEFT,
96 'right' => STR_PAD_RIGHT,
97 'both' => STR_PAD_BOTH
99 $padType = $arguments[
'padType'];
100 if (!isset($padTypes[$padType])) {
104 return str_pad($value, $arguments[
'padLength'], $arguments[
'padString'], $padTypes[$padType]);