1 views_plugin_query_default.inc views_plugin_query_default::add_table($table, $relationship = NULL, $join = NULL, $alias = NULL)

Add a table to the query, ensuring the path exists.

This function will test to ensure that the path back to the primary table is valid and exists; if you do not wish for this testing to occur, use $query->queue_table() instead.

Parameters

$table: The name of the table to add. It needs to exist in the global table array.

$relationship: An alias of a table; if this is set, the path back to this table will be tested prior to adding the table, making sure that all intermediary tables exist and are properly aliased. If set to NULL the path to the primary table will be ensured. If the path cannot be made, the table will NOT be added.

views_join $join: In some join configurations this table may actually join back through a different method; this is most likely to be used when tracing a hierarchy path. (node->parent->parent2->parent3). This parameter will specify how this table joins if it is not the default.

$alias: A specific alias to use, rather than the default alias.

Return value

$alias: The alias of the table; this alias can be used to access information about the table and should always be used to refer to the table when adding parts to the query. Or FALSE if the table was not able to be added.

File

core/modules/views/plugins/views_plugin_query_default.inc, line 397
Defines the default query object.

Class

views_plugin_query_default
Object used to create a SELECT query.

Code

function add_table($table, $relationship = NULL, $join = NULL, $alias = NULL) {
  if (!$this->ensure_path($table, $relationship, $join)) {
    return FALSE;
  }

  if ($join && $relationship) {
    $join = $this->adjust_join($join, $relationship);
  }

  return $this->queue_table($table, $relationship, $join, $alias);
}