ep:price()} € */ class PriceViewHelper extends AbstractViewHelper { use CompileWithContentArgumentAndRenderStatic; public function initializeArguments() { parent::initializeArguments(); $this->registerArgument('value', 'mixed', 'Amount in euros'); } /** * @param array $arguments * @param \Closure $renderChildrenClosure * @param RenderingContextInterface $renderingContext * @return string */ public static function renderStatic( array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext ) { $amount = round((float) $renderChildrenClosure(), 2); $decimals = floor($amount) === $amount ? 0 : 2; return number_format($amount, $decimals, ',', ''); } }