The GPL headers named dreipunktnull and an old address and no longer match the license of the code. Co-Authored-By: Claude Opus 5.5 <[email protected]>
35 lines
1015 B
PHP
35 lines
1015 B
PHP
<?php
|
|
|
|
namespace EP\EpTheme\ViewHelpers;
|
|
|
|
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
|
|
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
|
|
|
|
class PriceRangeViewHelper extends AbstractViewHelper
|
|
{
|
|
public function initializeArguments()
|
|
{
|
|
parent::initializeArguments();
|
|
|
|
$this->registerArgument('min', 'mixed', 'Price range start');
|
|
$this->registerArgument('max', 'mixed', 'Price range end');
|
|
}
|
|
|
|
/**
|
|
* @param array $arguments
|
|
* @param \Closure $renderChildrenClosure
|
|
* @param RenderingContextInterface $renderingContext
|
|
* @return mixed
|
|
*/
|
|
public function render()
|
|
{
|
|
if (1 === (int) $this->arguments['min']) {
|
|
return sprintf('bis %d €', $this->arguments['max']);
|
|
}
|
|
if (999 === (int) $this->arguments['max']) {
|
|
return sprintf('ab %d €', $this->arguments['min']);
|
|
}
|
|
return sprintf('%d bis %d €', $this->arguments['min'], $this->arguments['max']);
|
|
}
|
|
}
|