yii form custom label

To create a custom label for a form field in Yii, you can use the label() method provided by the yii\widgets\ActiveField class. The label() method allows you to specify a custom label for the form field.

Here's an example of how you can use the label() method to create a custom label:

<?= $form->field($model, 'attribute')->label('Custom Label') ?>

In the example above, $model represents the model associated with the form, and 'attribute' is the attribute name of the form field. The label() method is chained to the field() method of the $form object, and the custom label text 'Custom Label' is passed as a parameter to the label() method.

By using this approach, you can easily create custom labels for your form fields in Yii.