function Field::get_base_table in Views (for Drupal 7) 8.3
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 lib/
Views/ field/ Plugin/ views/ field/ Field.php - Check whether current user has access to this handler.
- Field::query in lib/
Views/ field/ Plugin/ views/ field/ Field.php - Called to add the field to a query.
File
- lib/
Views/ field/ Plugin/ views/ field/ Field.php, line 115 - Definition of Views\field\Plugin\views\field\Field.
Class
- Field
- A field that displays fieldapi fields.
Namespace
Views\field\Plugin\views\fieldCode
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->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_fetch_data($options['table']);
$this->base_table = $data[$options['field']]['relationship']['base'];
}
}
}
return $this->base_table;
}