You are here

public function field_collection_handler_relationship::ensure_my_table in Field collection 7

Ensure the main table for this handler is in the query. This is used a lot.

Overrides views_handler::ensure_my_table

File

views/field_collection_handler_relationship.inc, line 46
Provide relationship handler for field collection fields.

Class

field_collection_handler_relationship
@file Provide relationship handler for field collection fields.

Code

public function ensure_my_table() {
  $field = field_info_field($this->definition['field_name']);
  if (!isset($this->table_alias)) {
    $join = $this
      ->get_join();
    if ($this->options['delta'] != -1 && $field['cardinality']) {
      $join->extra[] = array(
        'field' => 'delta',
        'value' => $this->options['delta'],
        'numeric' => TRUE,
      );
    }
    $this->table_alias = $this->query
      ->add_table($this->table, $this->relationship, $join);
  }
  return $this->table_alias;
}