field = $field; } public function getLabel(): ?CLabel { $label = parent::getLabel(); if ($label !== null) { $label->setFor($this->getSelect()->getFocusableElementId()); } return $label; } public function getView(): CSelect { return $this->getSelect(); } private function getSelect(): CSelect { if ($this->select === null) { $this->select = (new CSelect($this->field->getName())) ->setId($this->field->getName()) ->setFocusableElementId('label-'.$this->field->getName()) ->setValue($this->field->getValue()) ->addOptions(CSelect::createOptionsFromArray($this->field->getValues())) ->setDisabled($this->isDisabled()) ->setAriaRequired($this->isRequired()); } return $this->select; } }