yii\helpers\BaseHtml::activeLabel PHP Method

activeLabel() public static method

The label text is the label associated with the attribute, obtained via [[Model::getAttributeLabel()]].
public static activeLabel ( Model $model, string $attribute, array $options = [] ) : string
$model yii\base\Model the model object
$attribute string the attribute name or expression. See [[getAttributeName()]] for the format about attribute expression.
$options array the tag options in terms of name-value pairs. These will be rendered as the attributes of the resulting tag. The values will be HTML-encoded using [[encode()]]. If a value is null, the corresponding attribute will not be rendered. The following options are specially handled: - label: this specifies the label to be displayed. Note that this will NOT be [[encode()|encoded]]. If this is not set, [[Model::getAttributeLabel()]] will be called to get the label for display (after encoding). See [[renderTagAttributes()]] for details on how attributes are being rendered.
return string the generated label tag
    public static function activeLabel($model, $attribute, $options = [])
    {
        $for = ArrayHelper::remove($options, 'for', static::getInputId($model, $attribute));
        $attribute = static::getAttributeName($attribute);
        $label = ArrayHelper::remove($options, 'label', static::encode($model->getAttributeLabel($attribute)));
        return static::label($label, $for, $options);
    }