1 views_handler_field_field.inc views_handler_field_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".

File

core/modules/field/views/views_handler_field_field.inc, line 135
Definition of views_handler_field_field.

Class

views_handler_field_field
A field that displays fieldapi fields.

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->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;
}