You are here

public function FieldCollectionHandlerRelationship::ensureMyTable in Field collection 8

Same name and namespace in other branches
  1. 8.3 src/Plugin/views/relationship/FieldCollectionHandlerRelationship.php \Drupal\field_collection\Plugin\views\relationship\FieldCollectionHandlerRelationship::ensureMyTable()

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

Overrides HandlerBase::ensureMyTable

File

src/Plugin/views/relationship/FieldCollectionHandlerRelationship.php, line 59

Class

FieldCollectionHandlerRelationship
Relationship handler to return the taxonomy terms of nodes.

Namespace

Drupal\field_collection\Plugin\views\relationship

Code

public function ensureMyTable() {
  $field = FieldStorageConfig::loadByName($this->definition['target entity type'], $this->definition['field name']);
  $cardinality = $field
    ->getCardinality();
  if (!isset($this->tableAlias)) {
    $join = $this
      ->getJoin();
    if ($this->options['delta'] != -1 && $cardinality) {
      $join->extra[] = [
        'field' => 'delta',
        'value' => $this->options['delta'],
        'numeric' => TRUE,
      ];
    }
    $this->tableAlias = $this->query
      ->ensureTable($this->table, $this->relationship, $join);
    return $this->tableAlias;
  }
}