protected function mainElementHTML() { if ($this->useInput) { $this->prefillInput(); } $html = '<select ' . buildAttributes($this->attrs()) . '>'; $html = array_reduce($this->optGroups, function ($html, OptGroup $optGroup) { return $html . $optGroup->toHTML(); }, $html); $html .= '</select>'; return $html; }