Is There Better Way To Customize Form Label Names By User?

I have a requirement that User should be allowed to customize the form field label texts. Is there any way to handle this? I am planning to do database way store and allow User to edit that and display dynamically from db the label texts. Please advise.

Check the attachment.4880

label.png

Of course you have to store this in a database.

You may consider using the translation method in Yii (Yii::t) and use a slightly modified version of CDbMessageSource to look up user specific translations.

That means that your ‘attributes()’ method in the model just has to use Yii::t (as usual if you do I18N), and that the logic is in the MessageSource class.

Your labels before translation should be something like: ‘lb.Model.AttributeName’ in order to avoid “translation conflicts” - if your label would be ‘From’ before translation and you allow the user to change that, then everywher in your application you would get that new translation for ‘From’;

This may not be a good technique in the long term as it would mix translations with changes to field names, but it may be efficient for a small application.

Exactly, I am playing with DB… will use Yii::t , Thanks