You are here

public function EqViewsData::getViewsData in EntityFieldQuery Views Backend 8

Returns views data for the entity type.

Return value

array Views data in the format of hook_views_data().

Overrides EntityViewsDataInterface::getViewsData

File

src/EqViewsData.php, line 42
Contains \Drupal\efq_views\EqViewsData.

Class

EqViewsData

Namespace

Drupal\efq_views

Code

public function getViewsData() {
  $data = [];
  $base_table = 'eq__' . $this->entityType
    ->id();
  $data[$base_table]['table']['group'] = $this
    ->t('EQ @label', [
    '@label' => $this->entityType
      ->getLabel(),
  ]);
  $data[$base_table]['table']['provider'] = $this->entityType
    ->getProvider();
  $data[$base_table]['table']['base'] = [
    'query_id' => 'entity_field_query',
    'field' => $this->entityType
      ->getKey('id'),
    'title' => $this
      ->t('EQ @label', [
      '@label' => $this->entityType
        ->getLabel(),
    ]),
    'cache_contexts' => $this->entityType
      ->getListCacheContexts(),
  ];
  return $data;
}