You are here

public function views_join::construct in Views (for Drupal 7) 7.3

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

Construct the views_join object.

1 call to views_join::construct()
views_join_subquery::construct in includes/handlers.inc
Construct the views_join object.
1 method overrides views_join::construct()
views_join_subquery::construct in includes/handlers.inc
Construct the views_join object.

File

includes/handlers.inc, line 1592
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

public 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';
  }
}