You are here

function redhen_relation_handler_field_primary_contact::ensure_table in RedHen CRM 7

Called to add the correct field alias in the query for this field.

1 call to redhen_relation_handler_field_primary_contact::ensure_table()
redhen_relation_handler_field_primary_contact::query in modules/redhen_relation/includes/views/redhen_relation_handler_field_primary_contact.inc
Called to add the field to a query.

File

modules/redhen_relation/includes/views/redhen_relation_handler_field_primary_contact.inc, line 24
Field that indicates of a specific contact is the primary contact for an organization

Class

redhen_relation_handler_field_primary_contact
@file Field that indicates of a specific contact is the primary contact for an organization

Code

function ensure_table($table, $relationship = NULL, $join = NULL) {

  // Check if the normal ensure_table works...
  if ($alias = $this->query
    ->ensure_table($table, $relationship, $join)) {
    return $alias;
  }

  // Dig into what's available and pick a likely looking alias.
  foreach ($this->query->relationships as $alias => $info) {
    if ($relationship == $info['link']) {
      return $alias;
    }
  }

  // If we get to here, whatever. We don't check the return value anyway.
  return FALSE;
}