<?php

namespace Internetgalerie\IgDatapoolFe\ViewHelpers\Form;

/**
 * Renders an AJAX FileReference Field.
 */
class FileReferenceViewHelper extends AbstractFileReferenceViewHelper
{
    /**
     * Renders the upload field with possible resource pointer
     *
     * @return string
     * @api
     */
    public function render(): string
    {
        $this->formUtility->addJsFooter();
        $this->prepareOptions();

        if ($this->dragAndDrop) {
            $this->cssClasses[]='dp-dropzone';
        }

        //the current File.
        //might be an arary or objectstorage or a fileReferences or NULL.
        $value = $this->getUploadedResource();

        //$mappingResultsForProperty = $this->getMappingResultsForProperty();

        return $this->renderHtml($value);
    }
}
