Custom model attributes for certain views

Hello, I am a Yii nob - what I wanted to do was to have different attribute labels for regular views vs. create/update forms. I have a separate function in my model called formAttributeLabels(), but I don’t know how I can use that function instead of attributeLabels() in the create.php/update.php files (or _form.php). Any help is appreciated, thanks.

My suggestion is to return the appropriate labels from the attributeLabels() method based on scenario.

You can put an if then else in there…

Is there a special variable that holds the current view being displayed?

My suggestion is to return the appropriate labels from the attributeLabels() method based on scenario.

You can put an if then else in there…

$this-route in the controller but you should use $midel-scenario

thanks, the only issue I’m having is that $this->scenario in the model file is returning “Update” for everything except the Create New page and the Advanced Search. For some reason it returns Update in the view pages (viewing individual records as well as all of the records). So I can get it to display the custom attributes on the Create New page no problem, but if I wanted to extend it to the Update/Edit record page I can’t do that without changing the view pages as well…