initializeArguments())") */ public function introduceRenderFuncArgument(JoinPointInterface $joinPoint): void { $proxy = $joinPoint->getProxy(); if (!($proxy instanceof SelectViewHelper)) { return; } $proxy->registerArgument('renderFunction', 'string', 'callabe to use to render single object'); } /** * @Flow\After("setting(DigiComp.FluidRenderFunctions.enableAspects.select) && method(Neos\FluidAdaptor\ViewHelpers\Form\SelectViewHelper->validateArguments())") */ public function validateRenderFunction(JoinPointInterface $joinPoint): void { $proxy = $joinPoint->getProxy(); if (!($proxy instanceof SelectViewHelper)) { return; } if (!isset($proxy->arguments['renderFunction'])) { return; } $renderFunction = $proxy->viewHelperVariableContainer->get( RegisterRenderFunctionViewHelper::class, $proxy->arguments['renderFunction'] ); if (!($renderFunction instanceof InvokeRenderFunctionInterface)) { throw new \InvalidArgumentException( 'render function with name "' . $proxy->arguments['renderFunction'] . '" has not been registered.', 1717293038 ); } $proxy->arguments['renderFunction'] = $renderFunction; $originalOptions = $proxy->arguments['options']; if (!\is_iterable($originalOptions)) { // Validation is left to the original view helper return; } $proxy->arguments['options'] = new GeneratorClosureIterator( static function () use ($originalOptions, $renderFunction) { foreach ($originalOptions as $option) { yield new RenderableProxy($renderFunction, $option); } } ); } }