adjustLabelFor($options); $this->parts['{input}'] = Html::activeStaticControl($this->model, $this->attribute, $options); return $this; } public function suffix($suffix = '', $suffixType = 'addon', $size = 300) { $size = !empty($size) ? "input-group-{$size} " : ''; $this->template = "{label}\n
{input}\n
" . $suffix . "
\n{hint}\n{error}"; return $this; } public function prefix($prefix = '', $prefixType = 'addon', $size = 300) { $size = !empty($size) ? "input-group-{$size} " : ''; $this->template = "{label}\n
" . $prefix . "
\n{input}
\n{hint}\n{error}"; return $this; } public function boolean($options = [], $enclosedByLabel = true) { if ($enclosedByLabel) { $this->parts['{input}'] = Html::activeBoolean($this->model, $this->attribute, $options); $this->parts['{label}'] = ''; } else { if (isset($options['label']) && !isset($this->parts['{label}'])) { $this->parts['{label}'] = $options['label']; if (!empty($options['labelOptions'])) { $this->labelOptions = $options['labelOptions']; } } unset($options['labelOptions']); $options['label'] = null; $this->parts['{input}'] = Html::activeBoolean($this->model, $this->attribute, $options); } $this->adjustLabelFor($options); return $this; } /** * 输入框添加尾巴 * @param string $suffix * @param string $suffixType * @return $this * @author nodelog */ public function inputSuffix($suffix = '', $suffixType = 'addon') { $this->parts['{input}'] = "
" . $this->parts['{input}'] ."
" . $suffix . "
"; return $this; } }