There’s no need to change Yii::$classMap when you want to extend a framework class. Just put the file that contains your extended class in an imported directory (protected/components). Use $classMap only when you want to replace a class entirely. In this case the replacement class must have the same name as the original class (for obvious reasons) - it means that you can’t extend the replacement class from the original one.
and made a full copy of the original CHtml class, replacing the desired methods.
That’s not ideal, but it works without modifying the core class.
By the way, I need to use the same class name because I want to override the behavior of CHtml in the whole application, including zii components.
Would be great to be able to inherit the original class, override the desired methods, and use the new class with a new name in the application mapping the original name to the new name. No idea on how can it be done, be would be great =)
ok I have been trying to do the same thing. You’ve gotten so close. How does one simply override only the “method” that you want to change/alter in Chtml Class. For example hiddenField() function does not allow values that are arrays. I simply want to override that method when I am building a form any thoughts on how to override specific methods not the entire class itself.
yes I have view your post a ton and it would accomplish what I need. MY orignal problem was that when I tried to strore checkbox list values in the DB they were be stored as an Array? rather than the individual values. But I do not want to highjack the thread and post elsewhere for a solution I will edit this post once I find the appropriate discussion.