You are here

public function metatag_handler_field_entity::get_base_table in Metatag 7

Set the base_table and base_table_alias.

Copy of views_handler_field_field::get_base_table().

Return value

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

1 call to metatag_handler_field_entity::get_base_table()
metatag_handler_field_entity::query in views/metatag_handler_field_entity.inc
Heavily modified code from views_hander_field_field::query().

File

views/metatag_handler_field_entity.inc, line 53
Main handler for Metatag data.

Class

metatag_handler_field_entity
Class metatag_handler_entity.

Code

public function get_base_table() {
  $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']);
      $base_table = $data[$options['field']]['relationship']['base'];
    }
  }
  return $base_table;
}