简体   繁体   中英

Html tag is not working inside model attribute label in Yii2

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....

$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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM