You are here

function content_views_field_handler_group in Content Construction Kit (CCK) 5

2 calls to content_views_field_handler_group()
content_views_field_handler_first in ./content_views.inc
content_views_field_handler_last in ./content_views.inc
1 string reference to 'content_views_field_handler_group'
content_views_field_query_handler in ./content_views.inc

File

./content_views.inc, line 147
Interface between content.module and views.module.

Code

function content_views_field_handler_group($field_info, $field_data, $value, $data, $from = 0, $count = 'all', $order = 'ASC') {
  $field = $field_info['content_field'];
  $items = array();
  if ($field['multiple']) {
    $table_alias = "node_data_{$field['field_name']}";
    foreach ($field_info['content_db_info']['columns'] as $column => $attributes) {
      $query_columns[] = "{$table_alias}.{$attributes['column']} AS {$column}";
    }
    $query_columns[] = "{$table_alias}.delta AS delta";

    // Note : this query doesn't need to run through db_rewrite_sql, since the
    // nids we retrieve have been selected by the views query, which already takes
    // care of this.
    $query = "SELECT " . implode(', ', $query_columns) . " FROM {node} node" . " LEFT JOIN {" . $field_info['content_db_info']['table'] . "} {$table_alias} ON node.vid = {$table_alias}.vid" . " WHERE node.nid = " . $data->nid . " ORDER BY {$table_alias}.delta {$order}";

    // Select all deltas or only a subset.
    // Currently only 'all' and first / last items are proposed to the user.
    $result = $count == 'all' ? db_query($query) : db_query_range($query, $from, $count);
    while ($item = db_fetch_array($result)) {
      $item['#delta'] = $item[delta];
      unset($item['delta']);
      $items[] = content_format($field, $item, $field_data['options'], $data);
    }
    return theme('content_view_multiple_field', $items, $field, $data);
  }
  else {
    return content_views_field_handler_ungroup($field_info, $field_data, $value, $data);
  }
}