You are here

public function GroupViewsData::getViewsData in Group 8

Same name and namespace in other branches
  1. 2.0.x src/Entity/Views/GroupViewsData.php \Drupal\group\Entity\Views\GroupViewsData::getViewsData()

Returns views data for the entity type.

Return value

array Views data in the format of hook_views_data().

Overrides EntityViewsData::getViewsData

File

src/Entity/Views/GroupViewsData.php, line 15

Class

GroupViewsData
Provides the views data for the group entity type.

Namespace

Drupal\group\Entity\Views

Code

public function getViewsData() {
  $data = parent::getViewsData();
  $data['groups_field_data']['id']['argument'] = [
    'id' => 'group_id',
    'name field' => 'label',
    'numeric' => TRUE,
  ];
  $data['groups_field_data']['group_content_id']['relationship'] = [
    'title' => $this
      ->t('Group content'),
    'help' => $this
      ->t('Relate to the group content entities. From there you can relate to the actual grouped entities.'),
    'id' => 'group_to_group_content',
    'base' => 'group_content_field_data',
    'base field' => 'gid',
    'field' => 'id',
    'label' => $this
      ->t('Group content'),
  ];
  return $data;
}