function Field::get_base_table

Set the base_table and base_table_alias.

Return value

string The base table which is used in the current view "context".

2 calls to Field::get_base_table()
Field::access in drupal/core/modules/field/lib/Drupal/field/Plugin/views/field/Field.php
Check whether current user has access to this handler.
Field::query in drupal/core/modules/field/lib/Drupal/field/Plugin/views/field/Field.php
Called to add the field to a query.

File

drupal/core/modules/field/lib/Drupal/field/Plugin/views/field/Field.php, line 165
Definition of Drupal\field\Plugin\views\field\Field.

Class

Field
A field that displays fieldapi fields.

Namespace

Drupal\field\Plugin\views\field

Code

function get_base_table() {
  if (!isset($this->base_table)) {

    // This base_table is coming from the entity not the field.
    $this->base_table = $this->view->storage
      ->get('base_table');

    // If the current field is under a relationship you can't be sure that the
    // base table of the view is the base table of the current field.
    // For example a field from a node author on a node view does have users as base table.
    if (!empty($this->options['relationship']) && $this->options['relationship'] != 'none') {
      $relationships = $this->view->display_handler
        ->getOption('relationships');
      if (!empty($relationships[$this->options['relationship']])) {
        $options = $relationships[$this->options['relationship']];
        $data = Views::viewsData()
          ->get($options['table']);
        $this->base_table = $data[$options['field']]['relationship']['base'];
      }
    }
  }
  return $this->base_table;
}