'string' ]; /** * @param $value * @return $this */ public function value($value) { if ($value === null) return $this; if (!is_array($value)) $this->value[] = (string)$value; else { foreach ($value as $v) { $this->value[] = (string)$v; } } return $this; } public function getValidateHandler() { return Validate::arr(); } /** * @return array */ public function build() { $options = []; foreach ($this->options as $option) { if ($option instanceof Option) $options[] = $option->build(); } $value = array_unique($this->value); foreach ($value as $k => $v) { $value[$k] = (string)$v; } return [ 'type' => $this->name, 'field' => $this->field, 'title' => $this->title, 'value' => $value, 'props' => (object)$this->props, 'options' => $options, 'validate' => $this->validate, 'col' => $this->col ]; } }