You are here

function content_handler_field_multiple::init in Content Construction Kit (CCK) 6.3

Same name and namespace in other branches
  1. 6.2 includes/views/handlers/content_handler_field_multiple.inc \content_handler_field_multiple::init()

Overrides content_handler_field::init

File

includes/views/handlers/content_handler_field_multiple.inc, line 13
An extended subclass for field handling that adds multiple field grouping.

Class

content_handler_field_multiple
@file An extended subclass for field handling that adds multiple field grouping.

Code

function init(&$view, $options) {
  $field = $this->content_field;
  parent::init($view, $options);
  $this->defer_query = !empty($options['multiple']['group']) && $field['multiple'];
  if ($this->defer_query) {

    // Grouped field: ditch the existing additional_fields (field columns + delta).
    // In the main query we'll only need:
    // - vid, which will be used to retrieve the actual values in pre_render,
    // - node type and nid, which wil be used in the pseudo-node used when
    // rendering.
    $this->additional_fields = array(
      'type' => array(
        'table' => 'node',
        'field' => 'type',
      ),
      'nid' => array(
        'table' => 'node',
        'field' => 'nid',
      ),
    );
    if ($view->base_table == 'node_revisions') {
      $this->additional_fields['vid'] = array(
        'table' => 'node_revisions',
        'field' => 'vid',
      );
    }
    else {
      $this->additional_fields['vid'] = array(
        'table' => 'node',
        'field' => 'vid',
      );
    }
  }
}