Support for scenario in attributeLabels


I am creating a function where the user can change his password. If you are an administrator you can even change the passwords for the other users too.

I am using an AR model for the user table. When the user registers he is using the register view, this view includes the password field. I have set the name of the password field to "Password" using the attributeLabels method in my model. All this is fine, the problem comes when I am creating the view file for the update Password action. Now I what the password field to be called "New Password". If I was able to specify a scenario in attributeLabels in a similar way to what you do with validation rules it would work better:


return array(array('password', 'New Password', 'on' => 'updatePassword'));


Is there a better way to solve this problem? If there isn't I think this could be a good addition to the model class. By the way I really like the way the scenarios work. It is a great way of making the most of the model class.

In most cases, I don't like using attributeLabels().  I think it creates more work then it helps.  So I would just write the label manually.

-my opinion

That is what I have done for now. I just find it convenient to be able to set the label from the model. This would automatically give me the right name for the specific field in the messages created by the validation rules. You don't want the label next to the field to specify a name like "password" and the error message to say "New password".