You are here

public function paragraphs_handler_relationship::ensure_my_table in Paragraphs 7

Makes sure our table is added to the join.

Return value

mixed The alias of the table of this handler which is used in the query.

Overrides views_handler::ensure_my_table

File

views/paragraphs_handler_relationship.inc, line 58

Class

paragraphs_handler_relationship
Provide relationship handler for paragraphs 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;
}