You are here

public function views_handler_field_field::get_base_table in Views (for Drupal 7) 7.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 views_handler_field_field::get_base_table()
views_handler_field_field::access in modules/field/views_handler_field_field.inc
Check whether current user has access to this handler.
views_handler_field_field::query in modules/field/views_handler_field_field.inc
Called to add the field to a query.

File

modules/field/views_handler_field_field.inc, line 139
Definition of views_handler_field_field.

Class

views_handler_field_field
A field that displays fieldapi fields.

Code

public 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->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
        ->get_option('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;
}