1 views_handler_field_entity.inc views_handler_field_entity::query()

Overridden to add the field for the entity ID.

Overrides views_handler_field::query

File

core/modules/views/handlers/views_handler_field_entity.inc, line 49
Definition of views_handler_field_entity.

Class

views_handler_field_entity
A handler to display data from entity objects.

Code

function query() {
  $this->table_alias = $base_table = $this->view->base_table;
  $this->base_field = $this->view->base_field;

  if (!empty($this->relationship)) {
    foreach ($this->view->relationship as $relationship) {
      if ($relationship->alias == $this->relationship) {
        $base_table = $relationship->definition['base'];
        $this->table_alias = $relationship->alias;

        $table_data = views_fetch_data($base_table);
        $this->base_field = empty($relationship->definition['base field']) ? $table_data['table']['base']['field'] : $relationship->definition['base field'];
      }
    }
  }

  // Add the field if the query back-end implements an add_field() method,
  // just like the default back-end.
  if (method_exists($this->query, 'add_field')) {
    $this->field_alias = $this->query->add_field($this->table_alias, $this->base_field, '');
  }

  $this->add_additional_fields();
}