/** * @inheritDoc */ public function label($model, $attribute, $htmlOptions = array()) { if (!$this->qualifyNames && !isset($htmlOptions['for'])) { $htmlOptions['for'] = \CHtml::getIdByName($attribute); } return parent::label($model, $attribute, $htmlOptions); }
/** * Renders an HTML label for a model attribute. * @param CModel $parentModel the parent data model * @param string $attributedPath the attribute or path to related model attribute * @param array $htmlOptions additional HTML attributes. * @return string the generated label tag */ public function label($parentModel, $attributedPath, $htmlOptions = array()) { list($model, $attribute, $htmlOptions) = self::resolveArgs($parentModel, $attributedPath, $htmlOptions); $htmlOptions['for'] = CHtml::getIdByName($htmlOptions['name']); if (!isset($htmlOptions['label']) && ($label = self::resolveLabel($parentModel, $attributedPath)) !== null) { $htmlOptions['label'] = $label; } return parent::label($model, $attribute, $htmlOptions); }
/** * Label * * A wrapper for CHtml::activeLabel(). It overrides the label() method in the parent class, CActiveForm, to * allow for form objects to be passed as well as form models. * * @access public * @param CForm|CModel $formModel * @param string $attribute * @param array $htmlOptions * @return string */ public function label($formModel, $attribute, $htmlOptions = array()) { if ($formModel instanceof \CForm && isset($formModel->model) && $formModel->model instanceof \CModel) { $formModel = $formModel->model; } return parent::label($formModel, $attribute, $htmlOptions); }
/** * Renders an HTML label for a model attribute. * This method is a wrapper of {@link TbHtml::activeLabel}. * Please check {@link TbHtml::activeLabel} for detailed information * about the parameters for this method. * @param CModel $model the data model * @param string $attribute the attribute * @param array $htmlOptions additional HTML attributes. * @return string the generated label tag */ public function label($model, $attribute, $htmlOptions = array()) { if ($this->type == TbHtml::FORM_HORIZONTAL) { $htmlOptions = TbHtml::addClassName('control-label', $htmlOptions); } return parent::label($model, $attribute, $htmlOptions); }