<?php

namespace Internetgalerie\IgDatapoolFe\ViewHelpers\Widget;

use TYPO3\CMS\Fluid\Core\Widget\AbstractWidgetViewHelper;
use Internetgalerie\IgDatapoolFe\ViewHelpers\Widget\Controller\AbcnateController;
use TYPO3\CMS\Extbase\Persistence\QueryResultInterface;

/**
 * Renders a ABC list
 */
class AbcnateViewHelper extends AbstractWidgetViewHelper
{
    /**
     * @var AbcnateController
     */
    protected $controller;

    /**
     * @param AbcnateController $controller
     */
    public function injectController(AbcnateController $controller): void
    {
        $this->controller = $controller;
    }

    /**
     * @param QueryResultInterface $objects
     * @param  string                                              $property
     * @param  string                                              $as
     * @return string
     */
    public function render(QueryResultInterface $objects, $property, $as, array $configuration = ['insertAbove' => false, 'insertBelow' => true])
    {
        $this->controller->setParentRequest($this->renderingContext->getRequest());
        return $this->initiateSubRequest();
    }
}
