You are here

function activity_views_handler_field_message::query in Activity 7

Same name and namespace in other branches
  1. 6.2 views/activity_views_handler_field_message.inc \activity_views_handler_field_message::query()

Override the query method to add the second table.

Overrides views_handler_field::query

File

views/views_handler_fields.inc, line 18
Provides the Views Field Handlers.

Class

activity_views_handler_field_message
Renders the message field for a given user

Code

function query() {
  $this
    ->ensure_my_table();

  // Join in the personal message table.
  $this->personal_msg_table = $this->query
    ->ensure_table('activity_personal_messages', $this->relationship);

  // Use the personal message if there is one otherwise use the non-personal.
  $this->field_alias = $this->query
    ->add_field(NULL, "COALESCE({$this->personal_msg_table}.message, {$this->table_alias}.{$this->real_field})", $this->table_alias . '_' . $this->real_field);
}