<?php

namespace Internetgalerie\IgDatapoolFe\ViewHelpers\Uri;

use TYPO3\CMS\Extbase\Mvc\Web\Routing\UriBuilder;
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
use TYPO3Fluid\Fluid\Core\ViewHelper\Traits\CompileWithRenderStatic;

class ActionViewHelper extends \Internetgalerie\IgCoreViewhelpers\ViewHelpers\Uri\ActionViewHelper
{
    /**
     * @param array $arguments
     * @param \Closure $renderChildrenClosure
     * @param RenderingContextInterface $renderingContext
     * @return string
     */
    public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext): string
    {
        // convert _ to @, stupid fluid parser...
        foreach ($arguments as $key => $arg) {
            if (strpos($key, '_') === 0) {
                $arguments['@' . ltrim($key, '_')] = $arg;
                unset($arguments[$key]);
            }
        }
        return parent::renderStatic($arguments, $renderChildrenClosure, $renderingContext);
        //$arguments = \Internetgalerie\IgDatapoolFe\Utility\NeedfulThings::keepAndOverrideArgs($arguments, $controllerContext->getRequest());
    }
}
