public static function HandlerBase::getTableJoin in Views (for Drupal 7) 8.3
Fetches a handler to join one table to a primary table from the data cache.
Parameters
string $table: The table to join from.
string $base_table: The table to join to.
Return value
Drupal\views\Plugin\views\join\JoinPluginBase
4 calls to HandlerBase::getTableJoin()
- ArgumentPluginBase::summary_name_field in lib/
Drupal/ views/ Plugin/ views/ argument/ ArgumentPluginBase.php - Add the name field, which is the field displayed in summary queries. This is often used when the argument is numeric.
- HandlerBase::getJoin in lib/
Drupal/ views/ Plugin/ views/ HandlerBase.php - Get the join object that should be used for this handler.
- ManyToOneHelper::add_table in lib/
Drupal/ views/ ManyToOneHelper.php - Add a table to the query.
- Sql::get_join_data in lib/
Drupal/ views/ Plugin/ views/ query/ Sql.php - Retrieve join data from the larger join data cache.
File
- lib/
Drupal/ views/ Plugin/ views/ HandlerBase.php, line 783 - Definition of Drupal\views\Plugin\views\HandlerBase.
Class
Namespace
Drupal\views\Plugin\viewsCode
public static function getTableJoin($table, $base_table) {
$data = views_fetch_data($table);
if (isset($data['table']['join'][$base_table])) {
$join_info = $data['table']['join'][$base_table];
if (!empty($join_info['join_id'])) {
$id = $join_info['join_id'];
}
else {
$id = 'standard';
}
$configuration = $join_info;
// Fill in some easy defaults.
if (empty($configuration['table'])) {
$configuration['table'] = $table;
}
// If this is empty, it's a direct link.
if (empty($configuration['left_table'])) {
$configuration['left_table'] = $base_table;
}
if (isset($join_info['arguments'])) {
foreach ($join_info['arguments'] as $key => $argument) {
$configuration[$key] = $argument;
}
}
$join = drupal_container()
->get('plugin.manager.views.join')
->createInstance($id, $configuration);
return $join;
}
}