本文整理汇总了PHP中CActiveForm::label方法的典型用法代码示例。如果您正苦于以下问题:PHP CActiveForm::label方法的具体用法?PHP CActiveForm::label怎么用?PHP CActiveForm::label使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CActiveForm
的用法示例。
在下文中一共展示了CActiveForm::label方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: label
/**
* @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);
}
示例2: label
/**
* 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);
}
示例3: label
/**
* 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);
}
示例4: label
/**
* 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);
}