1.20.x handlers.inc views_join::construct($table = NULL, $left_table = NULL, $left_field = NULL, $field = NULL, $extra = array(), $type = 'LEFT')

Construct the views_join object.

File

modules/views/includes/handlers.inc, line 1007
Defines the various handler objects to help build and display views.

Class

views_join
A function class to represent a join and create the SQL necessary to implement the join.

Code

function construct($table = NULL, $left_table = NULL, $left_field = NULL, $field = NULL, $extra = array(), $type = 'LEFT') {
  $this->extra_type = 'AND';
  if (!empty($table)) {
    $this->table = $table;
    $this->left_table = $left_table;
    $this->left_field = $left_field;
    $this->field = $field;
    $this->extra = $extra;
    $this->type = strtoupper($type);
  }
  elseif (!empty($this->definition)) {
    // if no arguments, construct from definition.
    // These four must exist or it will throw notices.
    $this->table = $this->definition['table'];
    $this->left_table = $this->definition['left_table'];
    $this->left_field = $this->definition['left_field'];
    $this->field = $this->definition['field'];
    if (!empty($this->definition['extra'])) {
      $this->extra = $this->definition['extra'];
    }
    if (!empty($this->definition['extra type'])) {
      $this->extra_type = strtoupper($this->definition['extra type']);
    }

    $this->type = !empty($this->definition['type']) ? strtoupper($this->definition['type']) : 'LEFT';
  }
}