Yii2 Form Label Control

Form is very popular in Yii2, this topic show how to control label in Yii 2.0 framework, include: normal use, hide label, change label text

 

//Default & Normal
<?= $form->field($model, 'ee_type')->dropDownList(YiiLib::loadDDList()) ?>

// hide label type one
<?= $form->field($model, 'ee_type', ['labelOptions'=>['class' => 'hide']])->dropDownList(YiiLib::loadDDList()) ?>

// hide label type two
<?= $form->field($model, 'ee_type')->dropDownList(YiiLib::loadDDList())->label(false) ?>

// hide label type three
<?= $form->field($model, 'ee_type', ['options'=>['class'=>'hide']])->dropDownList(YiiLib::loadDDList()) ?>


// change label text
<?= $form->field($model, 'ee_type')->dropDownList(YiiLib::loadDDList())->label('Welcome To <small>YiiLib.com </small>') ?>