Reputation: 3
Html tag is not working inside model attribute label in Yii2
public function attributeLabels() {
return [
'name'=>' Name <br> Age',
];
}
Br tag is not working there, it is showing
tag in UI.
public function attributeLabels() {
$labels = [
'id' => 'ID',
'model_id' => 'Form Name',
'user_id' => 'User Name',
];
$model = $this->getFields(UcFormFields::STATIC_FIELDS);
foreach ($model as $field)
$labels[$field->varname] = Yii::t('app', $field->title);
$model = $this->getFields(UcFormFields::DYNAMIC_FIELDS);
foreach ($model as $field)
$labels[$field->varname] = "Question \n Instruction.."; // will be replaced by variable
$model = $this->getDepFields(UcFormFields::DYNAMIC_FIELDS);
foreach ($model as $field)
$labels[$field->varname] = Yii::t('app', $field->title);
return $labels;
}
The above one is actual code....
Upvotes: 0
Views: 625
Reputation: 13
$form->field($model, 'termsofuse')
->checkbox(['label' => Yii::t('app', 'I understand and agree to the <a href="#termsofuse">Terms of Use</a>.')])
->label(false);
More at Add encodeLabel in activeLabel #4039
Upvotes: 1