Permalink
Browse files

Allow CHtml::activeLabel to override the automatically generated 'for…

…' attribute
  • Loading branch information...
1 parent 1ff28a4 commit 60fd554eeac524e73ad625e05fa46e40be1e4bf9 qiang.xue committed Jun 24, 2009
Showing with 8 additions and 1 deletion.
  1. +1 −0 CHANGELOG
  2. +7 −1 framework/web/helpers/CHtml.php
View
@@ -19,6 +19,7 @@ Version 1.0.7 to be released
- New: Rolled back the change about treating tinyint(1) in MySQL as boolean (Qiang)
- New: Added support for displaying call stack information in trace messages (Qiang)
- New: Added 'index' option to AR relations so that related objects can be indexed by specific column value (Qiang)
+- New: Allow CHtml::activeLabel to override the automatically generated 'for' attribute (Qiang)
Version 1.0.6 June 7, 2009
--------------------------
@@ -984,7 +984,13 @@ protected static function inputField($type,$name,$value,$htmlOptions)
*/
public static function activeLabel($model,$attribute,$htmlOptions=array())
{
- $for=self::getIdByName(self::resolveName($model,$attribute));
+ if(isset($htmlOptions['for']))
+ {
+ $for=$htmlOptions['for'];
+ unset($htmlOptions['for']);
+ }
+ else
+ $for=self::getIdByName(self::resolveName($model,$attribute));
if(isset($htmlOptions['label']))
{
$label=$htmlOptions['label'];

0 comments on commit 60fd554

Please sign in to comment.