/** * @param string|null $label the label or null to use model label * @param array $options the tag options */ protected function renderLabelParts($label = null, $options = []) { $options = array_merge($this->labelOptions, $options); if ($label === null) { if (isset($options['label'])) { $label = $options['label']; unset($options['label']); } else { $attribute = Html::getAttributeName($this->attribute); $label = Html::encode($this->model->getAttributeLabel($attribute)); } } if (!isset($options['for'])) { $options['for'] = Html::getInputId($this->model, $this->attribute); } $this->parts['{beginLabel}'] = Html::beginTag('label', $options); $this->parts['{endLabel}'] = Html::endTag('label'); if (!isset($this->parts['{labelTitle}'])) { $this->parts['{labelTitle}'] = $label; } }