Изменить DISTINCT(node.nid) на собственное поле

d6, views 3.x

Нужно изменить DISTINCT(node.nid) на собственное поле.

пробую через собственный модуль

<?php
function custom_views_pre_render(&$view){
  if ($view->name == 'Redaction_choice')
  {
    $search = array('SELECT DISTINCT(node.nid)');
    $replace = array('SELECT DISTINCT (node_data_field_weight.field_weight_value)');
    $view->build_info['query'] = str_replace($search,
                                             $replace,
                                             $view->build_info['query']);
    $view->build_info['count_query'] = str_replace($search,
                                                   $replace,
                                                   $view->build_info['count_query']);
  }
}

не получается… :(

 
 
26.08.2011 — 16:55

Комментарии (1)

Аватар пользователя varvashenia
22.09.2011 — 12:53
1
 
 

стоит использовать hook_views_query_alter. Ибо hook_views_pre_render: This hook is called right before the render process. The query has been executed, and the pre_render() phase has already happened for handlers, so all data should be available.