Skip to content

Commit

Permalink
Allow CHtml::activeLabel to override the automatically generated 'for…
Browse files Browse the repository at this point in the history
…' attribute
  • Loading branch information
qiang.xue committed Jun 24, 2009
1 parent 1ff28a4 commit 60fd554
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -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
--------------------------
Expand Down
8 changes: 7 additions & 1 deletion framework/web/helpers/CHtml.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'];
Expand Down

0 comments on commit 60fd554

Please sign in to comment.