You are here

function views_join::construct in Views (for Drupal 7) 6.3

Same name and namespace in other branches
  1. 6.2 includes/handlers.inc \views_join::construct()
  2. 7.3 includes/handlers.inc \views_join::construct()

Construct the views_join object.

File

includes/handlers.inc, line 1590
handlers.inc 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);
  }
  else {
    if (!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';
    }
  }
}