dokuwiki\Form\DropdownElement::optGroups PHP Метод

optGroups() публичный Метод

optgroups have to be given as associative array * the key being the label of the group * the value being an array of options as defined in @see OptGroup::options()
public optGroups ( null | array $optGroups = null ) : OptGroup[] | DropdownElement
$optGroups null | array
Результат OptGroup[] | DropdownElement
    public function optGroups($optGroups = null)
    {
        if ($optGroups === null) {
            return $this->optGroups;
        }
        if (!is_array($optGroups)) {
            throw new \InvalidArgumentException(hsc('Argument must be an associative array of label => [options]!'));
        }
        $this->optGroups = array();
        foreach ($optGroups as $label => $options) {
            $this->addOptGroup($label, $options);
        }
        return $this;
    }