function views_plugin_query_default::init

Same name in other branches
  1. 6.x-3.x plugins/views_plugin_query_default.inc \views_plugin_query_default::init()

Overrides views_plugin_query::init

File

plugins/views_plugin_query_default.inc, line 123

Class

views_plugin_query_default
Object used to create a SELECT query.

Code

public function init($base_table = 'node', $base_field = 'nid', $options = array()) {
    parent::init($base_table, $base_field, $options);
    $this->base_table = $base_table;
    // Predefine these above, for clarity.
    $this->base_field = $base_field;
    $this->relationships[$base_table] = array(
        'link' => NULL,
        'table' => $base_table,
        'alias' => $base_table,
        'base' => $base_table,
    );
    // Unit the table queue with our primary table.
    $this->table_queue[$base_table] = array(
        'alias' => $base_table,
        'table' => $base_table,
        'relationship' => $base_table,
        'join' => NULL,
    );
    // Init the tables with our primary table.
    $this->tables[$base_table][$base_table] = array(
        'count' => 1,
        'alias' => $base_table,
    );
    // We no longer want the base field to appear automatically.
    // if ($base_field) {
    //   $this->fields[$base_field] = array(
    //     'table' => $base_table,
    //     'field' => $base_field,
    //     'alias' => $base_field,
    //   );
    // }.
    $this->count_field = array(
        'table' => $base_table,
        'field' => $base_field,
        'alias' => $base_field,
        'count' => TRUE,
    );
}