CDetailView uses it's own code instead of generateAttributeLabel() #1537

Closed
sergoulpus opened this Issue Oct 5, 2012 · 5 comments

2 participants

@sergoulpus

I think CDeailView widget should use generateAttributeLabel() method from the model, instead of doing the same thing itself.

@cebe
Yii Software LLC member

as far as I can see right now it is using CModel::getAttributeLabel() what do you mean, which code are you talking about?

https://github.com/yiisoft/yii/blob/master/framework/zii/widgets/CDetailView.php#L201

@cebe cebe was assigned Oct 5, 2012
@sergoulpus

See line 203 if the attribute name is not set it generates from the attribute name, which is exactly the functionality of generateAttributeLabel (code is exactly the same).

https://github.com/yiisoft/yii/blob/master/framework/zii/widgets/CDetailView.php#L203

@cebe
Yii Software LLC member

Okay, this is to not have CDetailview depend on CModel. Is there any problem with that?

@sergoulpus

I found this when I tried to rewrite the CModel::generateAttributeLabel()

But I do not understand your last comment, as CDetailview depends on CModel anyway with the CModel::getAttributeLabel() ?

@cebe
Yii Software LLC member

generateAttributeLabel() is ment to be used to quickly generate a working prototype as it guesses label names from attribute names to help you as you do not have to write code to get it to work. When you need you own labels, you have to use attributeLabels.

@cebe cebe closed this Oct 7, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment