Skip to content

Instantly share code, notes, and snippets.

@pzzrudlf
Last active December 9, 2015 09:26
Show Gist options
  • Select an option

  • Save pzzrudlf/bd490e36fb8b0580ba29 to your computer and use it in GitHub Desktop.

Select an option

Save pzzrudlf/bd490e36fb8b0580ba29 to your computer and use it in GitHub Desktop.
<?php $model->icon = $iconer;?>//此处是将$iconer变量的值传到icon成员变量里,在item回调函数里,用来判断是否是默认值(判断$checked是否是true)
<label class = 'control-label'><?=Yii::t('app', 'Icon');?>: </label><?= MyHtml::activeRadioList($model, 'icon', $i_data,['class'=>'radio_icon', 'encode' => 0,
'item' => function ($index, $label, $name, $checked, $value){
if ($checked) {//此处对应于第一行
return Html::radio($name, ['checked'=>true],['value'=>$value,'label'=>$label]);
}
return Html::radio($name, $checked,['value'=>$value,'label'=>$label]);
}])?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment