field = $field; } public function getView(): CCheckBoxList { $options = []; foreach ($this->field->getValues() as $key => $label) { $options[] = [ 'name' => $this->field->getName().'[]', 'id' => $this->field->getName().'_'.$key, 'label' => $label, 'value' => $key, 'checked' => in_array($key, $this->field->getValue()) ]; } return (new CCheckBoxList()) ->setOptions($options) ->setEnabled(!$this->isDisabled()) ->setColumns($this->columns); } public function setColumns(int $columns): self { $this->columns = $columns; return $this; } }