function views_handler_field_entity::query

Overriden to add the field for the entity id.

Overrides views_handler_field::query

2 methods override views_handler_field_entity::query()
views_handler_field_comment_link::query in modules/comment/views_handler_field_comment_link.inc
Overriden to add the field for the entity id.
views_handler_field_comment_node_link::query in modules/comment/views_handler_field_comment_node_link.inc
Overriden to add the field for the entity id.

File

handlers/views_handler_field_entity.inc, line 54

Class

views_handler_field_entity
A handler to display data from entity objects.

Code

public function query() {
    $this->table_alias = $this->view->base_table;
    $this->base_field = $this->view->base_field;
    if (!empty($this->relationship)) {
        foreach ($this->view->relationship as $relationship) {
            if (isset($relationship->alias) && $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();
}