After updating TYPO3, I get a TYPO3Fluid\Fluid\Core\ViewHelper\Exception "Undeclared arguments passed to ViewHelper ... maxRange Valid arguments are."
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
class NumberOfStarsViewHelper extends AbstractViewHelper
{
/**
* divides the maxRange with two
* (A rating of 10 results in 5 Starts e.g.)
*
* @param integer $maxRange
* @return boolean
*/
public function render($maxRange)
{
return array_fill(0, ($maxRange / 2), 'iter');
//===
}
}
What can i do? Thanks
here the solution:
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
use TYPO3Fluid\Fluid\Core\ViewHelper\Traits\CompileWithRenderStatic;
class NumberOfStarsViewHelper extends AbstractViewHelper
{
public function initializeArguments() {
parent::initializeArguments();
$this->registerArgument('maxRange', 'string', 'divides the maxRange with two', false, null);
}
use CompileWithRenderStatic;
public static function renderStatic(
array $arguments,
\Closure $renderChildrenClosure,
RenderingContextInterface $renderingContext
) {
return array_fill(0, ($arguments["maxRange"] / 2), 'iter');
}
}