hook_views_hander用法

Submitted by admin on Fri, 03/02/2012 - 07:59


class book_count_handler extends views_handler_field_numeric{
  function render($v){
    $count = $v->book_count_count;
    if($count>0){
     for($i=1;$i<$count+1;$i++){$options[] = $i;}
      $arr['#parents'][0] = 'test';
      $arr['#type'] = 'select';
      $arr['#options'] = $options;
      return theme('select',$arr);
    }else{
      return NULL;
    }
  }
}