YII:CButtonColumn中button设定不能给image设置样式


Source Code:framework/zii/widgets/grid/CButtonColumn.php#309 

protected function renderButton($id,$button,$row,$data)
{
    if (isset(
$button['visible']) && !$this->evaluateExpression($button['visible'],array('row'=>$row,'data'=>$data)))
          return;
    
$label=isset($button['label']) ? $button['label'] : $id;
    
$url=isset($button['url']) ? $this->evaluateExpression($button['url'],array('data'=>$data,'row'=>$row)) : '#';
    
$options=isset($button['options']) ? $button['options'] : array();
    if(!isset(
$options['title']))
        
$options['title']=$label;
    if(isset(
$button['imageUrl']) && is_string($button['imageUrl']))
        echo 
CHtml::link(CHtml::image($button['imageUrl'],$label),$url,$options);
    else
        echo 
CHtml::link($label,$url,$options);
}


以上code中的红色画线部分:

再看以下部分:

Source Code: framework/web/helpers/CHtml.php#396

public static function image($src,$alt='',$htmlOptions=array())
{
    
$htmlOptions['src']=$src;
    
$htmlOptions['alt']=$alt;
    return 
self::tag('img',$htmlOptions);
}

即:CButtonColumn中button设定当需要设置image时,$htmlOptions 为空,即不能给image设置宽长大小等样式!


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

莱登堡

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值