Change Model Attribute Labels In Form

Hi guys.

I have this in my view, just a basic model.

How would one go about changing the actual label displayed in the form ?

<?= $form->field($model, ‘title’)->textInput([‘maxlength’ => 255]) ?>

Thank you in advance fellow Yii users ;)

Not sure that you can do this in code, but you can do it by giving the database field (of your model) a comment, at least with sqlite.


<?= $form->field($model, 'title')->textInput(['maxlength' => 255])->label('New Label Here') ?>

Active Field

Yes this is the right way IMO… to override/customize your model attribute label.