function views_get_table_join
Fetch a handler to join one table to a primary table from the data cache.
4 calls to views_get_table_join()
- views_handler::get_join in includes/
handlers.inc - Get the join object that should be used for this handler.
- views_handler_argument::summary_name_field in handlers/
views_handler_argument.inc - Add the name field, which is the field displayed in summary queries.
- views_many_to_one_helper::add_table in includes/
handlers.inc - Add a table to the query.
- views_plugin_query_default::get_join_data in plugins/
views_plugin_query_default.inc - Retrieve join data from the larger join data cache.
File
-
includes/
handlers.inc, line 95
Code
function views_get_table_join($table, $base_table) {
$data = views_fetch_data($table);
if (isset($data['table']['join'][$base_table])) {
$h = $data['table']['join'][$base_table];
if (!empty($h['handler']) && class_exists($h['handler'])) {
$handler = new $h['handler']();
}
else {
$handler = new views_join();
}
// Fill in some easy defaults.
$handler->definition = $h;
if (empty($handler->definition['table'])) {
$handler->definition['table'] = $table;
}
// If this is empty, it's a direct link.
if (empty($handler->definition['left_table'])) {
$handler->definition['left_table'] = $base_table;
}
if (isset($h['arguments'])) {
call_user_func_array(array(
&$handler,
'construct',
), $h['arguments']);
}
else {
$handler->construct();
}
return $handler;
}
// DEBUG -- identify missing handlers.
vpr("Missing join: @table @base_table", array(
'@table' => $table,
'@base_table' => $base_table,
));
}