<?php

namespace Internetgalerie\IgDatapoolFe\ViewHelpers\Form;

use TYPO3\CMS\Core\Utility\GeneralUtility;

class AdvSelectViewHelper extends Select2ViewHelper
{
    /**
     * Initialize arguments.
     *
     * @return void
     * @api
     */
    public function initializeArguments(): void
    {
        parent::initializeArguments();
    }


    /**
     * Render the tag.
     *
     * @return string rendered tag.
     * @api
     */
    public function render(): string
    {
        $this->createPageRendererForSelect2();
        //static::$pageRenderer->addCssFile('EXT:ig_datapool_fe/Resources/Public/Css/select2.css');

        $class= 'dp-adv-select dp-select2';

        if ($this->tag->hasAttribute('class')) {
            $this->tag->addAttribute('class', $class . ' ' . $this->tag->getAttribute('class'));
            $this->arguments['class']= $class . ' ' . $this->tag->getAttribute('class');
        } else {
            $this->tag->addAttribute('class', $class);
            $this->arguments['class']= $class;
        }
        $this->tag->addAttribute('style', 'width: 100%;');
        $output = parent::render();


        return $output;
    }
}
