Issue Bug Closed

#91758OptgroupViewHelper uses wrong method to set disabled attribute

M. Ecker 07/07/20, 15:53 updated 10/08/21, 08:14

Description

Using f:form.select.optgroup with attribute disabled=“true” causes uncaught exception.

Reason:
TYPO3\CMS\Fluid\ViewHelpers\Form\Select\OptgroupViewHelper (line 46 in current master) calls
$this->tag->addAttributes(‘disabled’, ‘disabled’)
instead of
$this->tag->addAttribute(‘disabled’, ‘disabled’)

addAttributes expects array as first argument.

Solution:

        if ($this->arguments['disabled']) {
            $this->tag->addAttribute('disabled', 'disabled');
        } else {
            $this->tag->removeAttribute('disabled');
        }

or

        if ($this->arguments['disabled']) {
            $this->tag->addAttributes(['disabled'=>'disabled']);
        } else {
            $this->tag->removeAttribute('disabled');
        }

Reviews 1