function HandlerBase::getTableJoin

Same name in other branches
  1. 9 core/modules/views/src/Plugin/views/HandlerBase.php \Drupal\views\Plugin\views\HandlerBase::getTableJoin()
  2. 8.9.x core/modules/views/src/Plugin/views/HandlerBase.php \Drupal\views\Plugin\views\HandlerBase::getTableJoin()
  3. 10 core/modules/views/src/Plugin/views/HandlerBase.php \Drupal\views\Plugin\views\HandlerBase::getTableJoin()

Overrides ViewsHandlerInterface::getTableJoin

4 calls to HandlerBase::getTableJoin()
ArgumentPluginBase::summaryNameField in core/modules/views/src/Plugin/views/argument/ArgumentPluginBase.php
Adds the name field, which is the field displayed in summary queries.
HandlerBase::getJoin in core/modules/views/src/Plugin/views/HandlerBase.php
ManyToOneHelper::addTable in core/modules/views/src/ManyToOneHelper.php
Add a table to the query.
Sql::getJoinData in core/modules/views/src/Plugin/views/query/Sql.php
Retrieve join data from the larger join data cache.

File

core/modules/views/src/Plugin/views/HandlerBase.php, line 758

Class

HandlerBase
Base class for Views handler plugins.

Namespace

Drupal\views\Plugin\views

Code

public static function getTableJoin($table, $base_table) {
    $data = Views::viewsData()->get($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 = Views::pluginManager('join')->createInstance($id, $configuration);
        return $join;
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.